fix(api): check visibility for group members in groups endpoint

This commit is contained in:
spiral 2023-02-12 04:29:11 +00:00 committed by GitHub
parent b904be939a
commit a39d0c8ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,11 @@ public class GroupControllerV2: PKControllerBase
if (with_members && j_groups.Count > 0) if (with_members && j_groups.Count > 0)
{ {
var q = await _repo.GetGroupMemberInfo(await groups.Select(x => x.Id).ToListAsync()); var q = await _repo.GetGroupMemberInfo(await groups
.Where(g => g.Visibility.CanAccess(ctx))
.Select(x => x.Id)
.ToListAsync());
foreach (var row in q) foreach (var row in q)
if (row.MemberVisibility.CanAccess(ctx)) if (row.MemberVisibility.CanAccess(ctx))
@ -147,4 +151,4 @@ public class GroupControllerV2: PKControllerBase
return NoContent(); return NoContent();
} }
} }