Skip to content

Commit

Permalink
fixed removing manager from group
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimChegulov committed Aug 6, 2024
1 parent 81cc5c0 commit f725d28
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/ASC.Core.Common/Context/Impl/UserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ public async Task RemoveUserFromGroupAsync(Guid userId, Guid groupId)
return;
}

var managerIdTask = GetDepartmentManagerAsync(groupId);
var user = await GetUsersAsync(userId);
var isUserBefore = await this.IsUserAsync(user);
var isPaidUserBefore = await IsPaidUserAsync(user);
Expand All @@ -731,6 +732,12 @@ await permissionContext.DemandPermissionsAsync(new UserGroupObject(new UserAccou
Constants.Action_EditGroups);

await userService.RemoveUserGroupRefAsync(Tenant.Id, userId, groupId, UserGroupRefType.Contains);

var managerId = await managerIdTask;
if (managerId == userId)
{
await userService.RemoveUserGroupRefAsync(Tenant.Id, userId, groupId, UserGroupRefType.Manager);
}

ResetGroupCache(userId);

Expand Down

0 comments on commit f725d28

Please sign in to comment.