Aggregate document permissions for current user in API response (#18721)

* Create integration test verifying existing behaviour.

* Aggregate permissions per document for the current user response.

* Refactoring following Codescene warnings.
This commit is contained in:
Andy Butland
2025-04-09 10:57:50 +02:00
committed by GitHub
parent 1a9d8e3a5d
commit a0e3ca601e
4 changed files with 280 additions and 17 deletions

View File

@@ -159,7 +159,7 @@ public class UserGroupBuilder<TParent>
Key = key,
StartContentId = startContentId,
StartMediaId = startMediaId,
Permissions = _permissions
Permissions = _permissions,
};
BuildAllowedSections(userGroup);
@@ -169,7 +169,6 @@ public class UserGroupBuilder<TParent>
return userGroup;
}
private void BuildAllowedSections(UserGroup userGroup)
{
foreach (var section in _allowedSections)
@@ -204,6 +203,6 @@ public class UserGroupBuilder<TParent>
.WithAlias(alias + suffix)
.WithName(name + suffix)
.WithPermissions(permissions ?? new[] { "A", "B", "C" }.ToHashSet())
.WithAllowedSections(allowedSections ?? new[] { "content", "media" })
.WithAllowedSections(allowedSections ?? ["content", "media"])
.Build();
}