Add integration tests

This commit is contained in:
Nikolaj Geisle
2022-06-21 11:04:57 +02:00
parent c283cc498f
commit 9d912ea98a
4 changed files with 138 additions and 32 deletions

View File

@@ -216,9 +216,16 @@ public class ContentVariantMapper
private IEnumerable<string> GetLanguagePermissions<TVariant>(IContent content, MapperContext context, TVariant variantDisplay)
where TVariant : ContentVariantDisplay
{
context.Items.TryGetValue("CurrentUser", out var currentBackofficeUser);
IEnumerable<IReadOnlyUserGroup>? userGroups = null;
if (currentBackofficeUser is IUser currentIUserBackofficeUser)
{
userGroups = currentIUserBackofficeUser.Groups;
}
// Map allowed actions
IEnumerable<IReadOnlyUserGroup>? userGroups =
_backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser?.Groups;
userGroups ??= _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser?.Groups;
bool hasAccess = false;
if (userGroups is not null)
{