23.124. 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>
23.124.1. Inheritance
23.124.2. Implements
23.124.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
23.124.4. Constructors
23.124.4.1. Permission(string)
Constructs the permission from a string with format : Service:Name or Service:Name:Target
public Permission(string actionString)
23.124.4.1.1. Parameters
actionString string
String representation of the permission
23.124.4.1.2. Exceptions
Thrown if the string is not of the right format
Thrown if Service or Name is null or whitespace
23.124.4.2. Permission(string, string)
Creates a permission with the given service and name, target is
public Permission(string service, string name)
23.124.4.2.1. Parameters
service string
Service
name string
Name
23.124.4.3. Permission(string, string, string?)
Creates a permission with the given service, name and target
public Permission(string service, string name, string? target)
23.124.4.3.1. Parameters
service string
Service
name string
Name
target string?
Target, if null defaults to
23.124.5. Fields
23.124.5.1. Claim
C# Claim object equivalent to this permission
public readonly Claim Claim
23.124.5.1.1. Field Value
23.124.5.2. Name
Name of the permission, usually the affected method
public readonly string Name
23.124.5.2.1. Field Value
23.124.5.3. Separator
Separator used in permission strings
public const char Separator = ':'
23.124.5.3.1. Field Value
23.124.5.4. Service
Service targeted by the permission
public readonly string Service
23.124.5.4.1. Field Value
23.124.5.5. Target
target scope of the permission (All, self…)
public readonly string Target
23.124.5.5.1. Field Value
23.124.6. Methods
23.124.6.1. Equals(Permission?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Permission? other)
23.124.6.1.1. Parameters
other Permission?
An object to compare with this object.
23.124.6.1.2. Returns
true if the current object is equal to the other parameter; otherwise, false.
23.124.6.2. Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
23.124.6.2.1. Parameters
obj object?
The object to compare with the current object.
23.124.6.2.2. Returns
true if the specified object is equal to the current object; otherwise, false.
23.124.6.3. GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
23.124.6.3.1. Returns
A hash code for the current object.
23.124.6.4. ToBasePermission()
Base permission string of the permission (service:name)
public string ToBasePermission()
23.124.6.4.1. Returns
The base permission string of this permission, no target
23.124.6.5. ToString()
String representation of the permission
public override string ToString()
23.124.6.5.1. Returns
Returns the full permission string
23.124.7. Operators
23.124.7.1. operator ==(Permission?, Permission?)
Equality operator, see
public static bool operator ==(Permission? left, Permission? right)
23.124.7.1.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
23.124.7.1.2. Returns
true if left is equal to right, false otherwise
23.124.7.2. operator !=(Permission?, Permission?)
Inequality operator, see
public static bool operator !=(Permission? left, Permission? right)
23.124.7.2.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
23.124.7.2.2. Returns
false if left is equal to right, true otherwise