Fix formatting
This commit is contained in:
@@ -31,5 +31,5 @@ public interface IReadOnlyUserGroup
|
|||||||
|
|
||||||
IEnumerable<string> AllowedSections { get; }
|
IEnumerable<string> AllowedSections { get; }
|
||||||
|
|
||||||
IEnumerable<int> AllowedLanguages { get; }
|
IEnumerable<int> AllowedLanguages { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,22 @@ namespace Umbraco.Cms.Core.Models.Membership;
|
|||||||
|
|
||||||
public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGroup>
|
public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGroup>
|
||||||
{
|
{
|
||||||
public ReadOnlyUserGroup(
|
public ReadOnlyUserGroup(
|
||||||
int id,
|
int id,
|
||||||
string? name,
|
string? name,
|
||||||
string? icon,
|
string? icon,
|
||||||
int? startContentId,
|
int? startContentId,
|
||||||
int? startMediaId,
|
int? startMediaId,
|
||||||
string? alias,
|
string? alias,
|
||||||
IEnumerable<int> allowedLanguages,
|
IEnumerable<int> allowedLanguages,
|
||||||
IEnumerable<string> allowedSections,
|
IEnumerable<string> allowedSections,
|
||||||
IEnumerable<string>? permissions)
|
IEnumerable<string>? permissions)
|
||||||
{
|
{
|
||||||
Name = name ?? string.Empty;
|
Name = name ?? string.Empty;
|
||||||
Icon = icon;
|
Icon = icon;
|
||||||
Id = id;
|
Id = id;
|
||||||
Alias = alias ?? string.Empty;
|
Alias = alias ?? string.Empty;
|
||||||
AllowedLanguages = allowedLanguages.ToArray();
|
AllowedLanguages = allowedLanguages.ToArray();
|
||||||
AllowedSections = allowedSections.ToArray();
|
AllowedSections = allowedSections.ToArray();
|
||||||
Permissions = permissions?.ToArray();
|
Permissions = permissions?.ToArray();
|
||||||
|
|
||||||
@@ -61,6 +61,7 @@ public class ReadOnlyUserGroup : IReadOnlyUserGroup, IEquatable<ReadOnlyUserGrou
|
|||||||
/// flexible permissions structure in the future.
|
/// flexible permissions structure in the future.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IEnumerable<string>? Permissions { get; set; }
|
public IEnumerable<string>? Permissions { get; set; }
|
||||||
|
|
||||||
public IEnumerable<int> AllowedLanguages { get; private set; }
|
public IEnumerable<int> AllowedLanguages { get; private set; }
|
||||||
public IEnumerable<string> AllowedSections { get; private set; }
|
public IEnumerable<string> AllowedSections { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Umbraco.Cms.Core.Models.Membership;
|
|||||||
public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
||||||
{
|
{
|
||||||
// Custom comparer for enumerable
|
// Custom comparer for enumerable
|
||||||
private static readonly DelegateEqualityComparer<IEnumerable<string>> StringEnumerableComparer =
|
private static readonly DelegateEqualityComparer<IEnumerable<string>> _stringEnumerableComparer =
|
||||||
new(
|
new(
|
||||||
(enum1, enum2) => enum1.UnsortedSequenceEqual(enum2),
|
(enum1, enum2) => enum1.UnsortedSequenceEqual(enum2),
|
||||||
enum1 => enum1.GetHashCode());
|
enum1 => enum1.GetHashCode());
|
||||||
@@ -37,7 +37,7 @@ public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
|||||||
_name = string.Empty;
|
_name = string.Empty;
|
||||||
_shortStringHelper = shortStringHelper;
|
_shortStringHelper = shortStringHelper;
|
||||||
_sectionCollection = new List<string>();
|
_sectionCollection = new List<string>();
|
||||||
_languageCollection = new List<int>();
|
_languageCollection = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,7 +49,13 @@ public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
|||||||
/// <param name="permissions"></param>
|
/// <param name="permissions"></param>
|
||||||
/// <param name="icon"></param>
|
/// <param name="icon"></param>
|
||||||
/// <param name="shortStringHelper"></param>
|
/// <param name="shortStringHelper"></param>
|
||||||
public UserGroup(IShortStringHelper shortStringHelper, int userCount, string? alias, string? name, IEnumerable<string> permissions, string? icon)
|
public UserGroup(
|
||||||
|
IShortStringHelper shortStringHelper,
|
||||||
|
int userCount,
|
||||||
|
string? alias,
|
||||||
|
string? name,
|
||||||
|
IEnumerable<string> permissions,
|
||||||
|
string? icon)
|
||||||
: this(shortStringHelper)
|
: this(shortStringHelper)
|
||||||
{
|
{
|
||||||
UserCount = userCount;
|
UserCount = userCount;
|
||||||
@@ -85,7 +91,8 @@ public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
|||||||
{
|
{
|
||||||
get => _alias;
|
get => _alias;
|
||||||
set => SetPropertyValueAndDetectChanges(
|
set => SetPropertyValueAndDetectChanges(
|
||||||
value.ToCleanString(_shortStringHelper, CleanStringType.Alias | CleanStringType.UmbracoCase), ref _alias!, nameof(Alias));
|
value.ToCleanString(_shortStringHelper, CleanStringType.Alias | CleanStringType.UmbracoCase), ref _alias!,
|
||||||
|
nameof(Alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataMember]
|
[DataMember]
|
||||||
@@ -106,7 +113,7 @@ public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
|||||||
public IEnumerable<string>? Permissions
|
public IEnumerable<string>? Permissions
|
||||||
{
|
{
|
||||||
get => _permissions;
|
get => _permissions;
|
||||||
set => SetPropertyValueAndDetectChanges(value, ref _permissions, nameof(Permissions), StringEnumerableComparer);
|
set => SetPropertyValueAndDetectChanges(value, ref _permissions, nameof(Permissions), _stringEnumerableComparer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> AllowedSections => _sectionCollection;
|
public IEnumerable<string> AllowedSections => _sectionCollection;
|
||||||
@@ -130,28 +137,29 @@ public class UserGroup : EntityBase, IUserGroup, IReadOnlyUserGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<int> AllowedLanguages
|
public IEnumerable<int> AllowedLanguages
|
||||||
{
|
{
|
||||||
get => _languageCollection;
|
get => _languageCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAllowedLanguage(int languageId)
|
public void RemoveAllowedLanguage(int languageId)
|
||||||
|
{
|
||||||
|
if (_languageCollection.Contains(languageId))
|
||||||
{
|
{
|
||||||
if (_languageCollection.Contains(languageId))
|
_languageCollection.Remove(languageId);
|
||||||
_languageCollection.Remove(languageId);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddAllowedLanguage(int languageId)
|
public void AddAllowedLanguage(int languageId)
|
||||||
|
{
|
||||||
|
if (_languageCollection.Contains(languageId) == false)
|
||||||
{
|
{
|
||||||
if (_languageCollection.Contains(languageId) == false)
|
_languageCollection.Add(languageId);
|
||||||
_languageCollection.Add(languageId);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearAllowedLanguages()
|
public void ClearAllowedLanguages() => _languageCollection.Clear();
|
||||||
{
|
|
||||||
_languageCollection.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearAllowedSections() => _sectionCollection.Clear();
|
public void ClearAllowedSections() => _sectionCollection.Clear();
|
||||||
|
|
||||||
protected override void PerformDeepClone(object clone)
|
protected override void PerformDeepClone(object clone)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -757,7 +757,6 @@ public class ContentController : ContentControllerBase
|
|||||||
|
|
||||||
return pagedResult;
|
return pagedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a blueprint from a content item
|
/// Creates a blueprint from a content item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user