Fix up UserGroup to map new property properly
This commit is contained in:
@@ -11,7 +11,8 @@ public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGrou
|
||||
string? alias,
|
||||
IEnumerable<int> allowedLanguages,
|
||||
IEnumerable<string> allowedSections,
|
||||
IEnumerable<string>? permissions)
|
||||
IEnumerable<string>? permissions,
|
||||
bool hasAccessToAllLanguages)
|
||||
{
|
||||
Name = name ?? string.Empty;
|
||||
Icon = icon;
|
||||
@@ -24,9 +25,10 @@ public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGrou
|
||||
// Zero is invalid and will be treated as Null
|
||||
StartContentId = startContentId == 0 ? null : startContentId;
|
||||
StartMediaId = startMediaId == 0 ? null : startMediaId;
|
||||
HasAccessToAllLanguages = hasAccessToAllLanguages;
|
||||
}
|
||||
|
||||
[Obsolete("please use ctor that takes allowedActions instead, scheduled for removal in v12")]
|
||||
[Obsolete("please use ctor that takes allowedActions & hasAccessToAllLanguages instead, scheduled for removal in v12")]
|
||||
public ReadOnlyUserGroup(
|
||||
int id,
|
||||
string? name,
|
||||
@@ -36,7 +38,7 @@ public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGrou
|
||||
string? alias,
|
||||
IEnumerable<string> allowedSections,
|
||||
IEnumerable<string>? permissions)
|
||||
: this(id, name, icon, startContentId, startMediaId, alias, Enumerable.Empty<int>(), allowedSections, permissions)
|
||||
: this(id, name, icon, startContentId, startMediaId, alias, Enumerable.Empty<int>(), allowedSections, permissions, true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public static class UserGroupExtensions
|
||||
}
|
||||
|
||||
// otherwise create one
|
||||
return new ReadOnlyUserGroup(group.Id, group.Name, group.Icon, group.StartContentId, group.StartMediaId, group.Alias, group.AllowedLanguages, group.AllowedSections, group.Permissions);
|
||||
return new ReadOnlyUserGroup(group.Id, group.Name, group.Icon, group.StartContentId, group.StartMediaId, group.Alias, group.AllowedLanguages, group.AllowedSections, group.Permissions, group.HasAccessToAllLanguages);
|
||||
}
|
||||
|
||||
public static bool IsSystemUserGroup(this IUserGroup group) =>
|
||||
|
||||
@@ -116,5 +116,6 @@ internal static class UserFactory
|
||||
group.UserGroup2AppDtos.Select(x => x.AppAlias).WhereNotNull().ToArray(),
|
||||
group.DefaultPermissions == null
|
||||
? Enumerable.Empty<string>()
|
||||
: group.DefaultPermissions.ToCharArray().Select(x => x.ToString()));
|
||||
: group.DefaultPermissions.ToCharArray().Select(x => x.ToString()),
|
||||
group.HasAccessToAllLanguages);
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ public class UserGroupRepository : EntityRepositoryBase<int, IUserGroup>, IUserG
|
||||
entity.Id = id;
|
||||
|
||||
PersistAllowedSections(entity);
|
||||
PersistAllowedLanguages(entity);
|
||||
PersistAllowedLanguages(entity);
|
||||
|
||||
entity.ResetDirtyProperties();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class UserEditorAuthorizationHelperTests
|
||||
{
|
||||
var currentUser = Mock.Of<IUser>(user => user.Groups == new[]
|
||||
{
|
||||
new ReadOnlyUserGroup(1, "CurrentUser", "icon-user", null, null, groupAlias, new int[0], new string[0], new string[0]),
|
||||
new ReadOnlyUserGroup(1, "CurrentUser", "icon-user", null, null, groupAlias, new int[0], new string[0], new string[0], true),
|
||||
});
|
||||
IUser savingUser = null; // This means it is a new created user
|
||||
|
||||
|
||||
Reference in New Issue
Block a user