Skip to content

Commit

Permalink
fix access to rooms activities
Browse files Browse the repository at this point in the history
  • Loading branch information
andreysavihin committed Dec 25, 2023
1 parent 31c243a commit 08a23d1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions products/ASC.Files/Core/Configuration/ProductEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ public override async Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTi
limit: 100);
}

var docSpaceAdmin = await _userManager.IsDocSpaceAdminAsync(userId);

var disabledRooms = _roomsNotificationSettingsHelper.GetDisabledRoomsForCurrentUser();

var userRoomsWithRole = await GetUserRoomsWithRoleAsync(userId);
var userRoomsWithRole = await GetUserRoomsWithRoleAsync(userId, docSpaceAdmin);

var userRoomsWithRoleForSend = userRoomsWithRole.Where(r => !disabledRooms.Contains(r.Key));
var userRoomsForSend = userRoomsWithRoleForSend.Select(r => r.Key);

var docSpaceAdmin = await _userManager.IsDocSpaceAdminAsync(userId);

var result = new List<ActivityInfo>();

foreach (var e in events)
Expand Down Expand Up @@ -290,7 +290,7 @@ public override string Description
public override ProductContext Context => _productContext;
public override string ApiURL => string.Empty;

private async Task<Dictionary<string, bool>> GetUserRoomsWithRoleAsync(Guid userId)
private async Task<Dictionary<string, bool>> GetUserRoomsWithRoleAsync(Guid userId, bool isDocSpaceAdmin)
{
var result = new Dictionary<string, bool>();

Expand All @@ -312,6 +312,11 @@ private async Task<Dictionary<string, bool>> GetUserRoomsWithRoleAsync(Guid user
}
}

if (!isDocSpaceAdmin)
{
return result;
}

var virtualRoomsFolderId = await _globalFolder.GetFolderVirtualRoomsAsync(_daoFactory);
var archiveFolderId = await _globalFolder.GetFolderArchiveAsync(_daoFactory);

Expand Down

0 comments on commit 08a23d1

Please sign in to comment.