30.129. Class Permission
Namespace: ArmoniK.Core.Common.Auth.Authorization.Permissions
Assembly: ArmoniK.Core.Common.dll
Class used to store a permission
public sealed class Permission : IEquatable<Permission>
30.129.1. Inheritance
30.129.2. Implements
30.129.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
30.129.4. Constructors
30.129.4.1. Permission(string)
Constructs the permission from a string with format : Service:Name or Service:Name:Target
public Permission(string actionString)
30.129.4.1.1. Parameters
actionString string
String representation of the permission
30.129.4.1.2. Exceptions
Thrown if the string is not of the right format
Thrown if Service or Name is null or whitespace
30.129.4.2. Permission(string, string)
Creates a permission with the given service and name, target is
public Permission(string service, string name)
30.129.4.2.1. Parameters
service string
Service
name string
Name
30.129.4.3. Permission(string, string, string?)
Creates a permission with the given service, name and target
public Permission(string service, string name, string? target)
30.129.4.3.1. Parameters
service string
Service
name string
Name
target string?
Target, if null defaults to
30.129.5. Fields
30.129.5.1. Claim
C# Claim object equivalent to this permission
public readonly Claim Claim
30.129.5.1.1. Field Value
30.129.5.2. Name
Name of the permission, usually the affected method
public readonly string Name
30.129.5.2.1. Field Value
30.129.5.3. Separator
Separator used in permission strings
public const char Separator = ':'
30.129.5.3.1. Field Value
30.129.5.4. Service
Service targeted by the permission
public readonly string Service
30.129.5.4.1. Field Value
30.129.5.5. Target
target scope of the permission (All, self…)
public readonly string Target
30.129.5.5.1. Field Value
30.129.6. Methods
30.129.6.1. Equals(Permission?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Permission? other)
30.129.6.1.1. Parameters
other Permission?
An object to compare with this object.
30.129.6.1.2. Returns
true if the current object is equal to the other parameter; otherwise, false.
30.129.6.2. Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
30.129.6.2.1. Parameters
obj object?
The object to compare with the current object.
30.129.6.2.2. Returns
true if the specified object is equal to the current object; otherwise, false.
30.129.6.3. GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
30.129.6.3.1. Returns
A hash code for the current object.
30.129.6.4. ToBasePermission()
Base permission string of the permission (service:name)
public string ToBasePermission()
30.129.6.4.1. Returns
The base permission string of this permission, no target
30.129.6.5. ToString()
String representation of the permission
public override string ToString()
30.129.6.5.1. Returns
Returns the full permission string
30.129.7. Operators
30.129.7.1. operator ==(Permission?, Permission?)
Equality operator, see
public static bool operator ==(Permission? left, Permission? right)
30.129.7.1.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
30.129.7.1.2. Returns
true if left is equal to right, false otherwise
30.129.7.2. operator !=(Permission?, Permission?)
Inequality operator, see
public static bool operator !=(Permission? left, Permission? right)
30.129.7.2.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
30.129.7.2.2. Returns
false if left is equal to right, true otherwise