|
|
|
@ -20,7 +20,7 @@ public class PermissionDefinition : |
|
|
|
/// Parent of this permission if one exists.
|
|
|
|
/// If set, this permission can be granted only if parent is granted.
|
|
|
|
/// </summary>
|
|
|
|
public PermissionDefinition Parent { get; private set; } |
|
|
|
public PermissionDefinition? Parent { get; private set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// MultiTenancy side.
|
|
|
|
@ -40,7 +40,7 @@ public class PermissionDefinition : |
|
|
|
get => _displayName; |
|
|
|
set => _displayName = Check.NotNull(value, nameof(value)); |
|
|
|
} |
|
|
|
private ILocalizableString _displayName; |
|
|
|
private ILocalizableString _displayName = default!; |
|
|
|
|
|
|
|
public IReadOnlyList<PermissionDefinition> Children => _children.ToImmutableList(); |
|
|
|
private readonly List<PermissionDefinition> _children; |
|
|
|
@ -48,7 +48,7 @@ public class PermissionDefinition : |
|
|
|
/// <summary>
|
|
|
|
/// Can be used to get/set custom properties for this permission definition.
|
|
|
|
/// </summary>
|
|
|
|
public Dictionary<string, object> Properties { get; } |
|
|
|
public Dictionary<string, object?> Properties { get; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Indicates whether this permission is enabled or disabled.
|
|
|
|
@ -71,14 +71,14 @@ public class PermissionDefinition : |
|
|
|
/// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>.
|
|
|
|
/// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary.
|
|
|
|
/// </returns>
|
|
|
|
public object this[string name] { |
|
|
|
public object? this[string name] { |
|
|
|
get => Properties.GetOrDefault(name); |
|
|
|
set => Properties[name] = value; |
|
|
|
} |
|
|
|
|
|
|
|
protected internal PermissionDefinition( |
|
|
|
[NotNull] string name, |
|
|
|
ILocalizableString displayName = null, |
|
|
|
ILocalizableString? displayName = null, |
|
|
|
MultiTenancySides multiTenancySide = MultiTenancySides.Both, |
|
|
|
bool isEnabled = true) |
|
|
|
{ |
|
|
|
@ -87,7 +87,7 @@ public class PermissionDefinition : |
|
|
|
MultiTenancySide = multiTenancySide; |
|
|
|
IsEnabled = isEnabled; |
|
|
|
|
|
|
|
Properties = new Dictionary<string, object>(); |
|
|
|
Properties = new Dictionary<string, object?>(); |
|
|
|
Providers = new List<string>(); |
|
|
|
StateCheckers = new List<ISimpleStateChecker<PermissionDefinition>>(); |
|
|
|
_children = new List<PermissionDefinition>(); |
|
|
|
@ -95,7 +95,7 @@ public class PermissionDefinition : |
|
|
|
|
|
|
|
public virtual PermissionDefinition AddChild( |
|
|
|
[NotNull] string name, |
|
|
|
ILocalizableString displayName = null, |
|
|
|
ILocalizableString? displayName = null, |
|
|
|
MultiTenancySides multiTenancySide = MultiTenancySides.Both, |
|
|
|
bool isEnabled = true) |
|
|
|
{ |
|
|
|
@ -115,7 +115,7 @@ public class PermissionDefinition : |
|
|
|
|
|
|
|
PermissionDefinition ICanAddChildPermission.AddPermission( |
|
|
|
string name, |
|
|
|
ILocalizableString displayName = null, |
|
|
|
ILocalizableString? displayName = null, |
|
|
|
MultiTenancySides multiTenancySide = MultiTenancySides.Both, |
|
|
|
bool isEnabled = true) |
|
|
|
{ |
|
|
|
|