26.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>
26.124.1. Inheritance
26.124.2. Implements
26.124.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
26.124.4. Constructors
26.124.4.1. Permission(string)
Constructs the permission from a string with format : Service:Name or Service:Name:Target
public Permission(string actionString)
26.124.4.1.1. Parameters
actionString string
String representation of the permission
26.124.4.1.2. Exceptions
Thrown if the string is not of the right format
Thrown if Service or Name is null or whitespace
26.124.4.2. Permission(string, string)
Creates a permission with the given service and name, target is
public Permission(string service, string name)
26.124.4.2.1. Parameters
service string
Service
name string
Name
26.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)
26.124.4.3.1. Parameters
service string
Service
name string
Name
target string?
Target, if null defaults to
26.124.5. Fields
26.124.5.1. Claim
C# Claim object equivalent to this permission
public readonly Claim Claim
26.124.5.1.1. Field Value
26.124.5.2. Name
Name of the permission, usually the affected method
public readonly string Name
26.124.5.2.1. Field Value
26.124.5.3. Separator
Separator used in permission strings
public const char Separator = ':'
26.124.5.3.1. Field Value
26.124.5.4. Service
Service targeted by the permission
public readonly string Service
26.124.5.4.1. Field Value
26.124.5.5. Target
target scope of the permission (All, self…)
public readonly string Target
26.124.5.5.1. Field Value
26.124.6. Methods
26.124.6.1. Equals(Permission?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Permission? other)
26.124.6.1.1. Parameters
other Permission?
An object to compare with this object.
26.124.6.1.2. Returns
true if the current object is equal to the other parameter; otherwise, false.
26.124.6.2. Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
26.124.6.2.1. Parameters
obj object?
The object to compare with the current object.
26.124.6.2.2. Returns
true if the specified object is equal to the current object; otherwise, false.
26.124.6.3. GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
26.124.6.3.1. Returns
A hash code for the current object.
26.124.6.4. ToBasePermission()
Base permission string of the permission (service:name)
public string ToBasePermission()
26.124.6.4.1. Returns
The base permission string of this permission, no target
26.124.6.5. ToString()
String representation of the permission
public override string ToString()
26.124.6.5.1. Returns
Returns the full permission string
26.124.7. Operators
26.124.7.1. operator ==(Permission?, Permission?)
Equality operator, see
public static bool operator ==(Permission? left, Permission? right)
26.124.7.1.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
26.124.7.1.2. Returns
true if left is equal to right, false otherwise
26.124.7.2. operator !=(Permission?, Permission?)
Inequality operator, see
public static bool operator !=(Permission? left, Permission? right)
26.124.7.2.1. Parameters
left Permission?
left side Permission
right Permission?
right side Permission
26.124.7.2.2. Returns
false if left is equal to right, true otherwise