21.130. 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>

21.130.1. Inheritance

objectPermission

21.130.2. Implements

IEquatable<Permission>

21.130.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

21.130.4. Constructors

21.130.4.1. Permission(string)

Constructs the permission from a string with format : Service:Name or Service:Name:Target

public Permission(string actionString)

21.130.4.1.1. Parameters

actionString string

String representation of the permission

21.130.4.1.2. Exceptions

ArgumentOutOfRangeException

Thrown if the string is not of the right format

ArgumentException

Thrown if Service or Name is null or whitespace

21.130.4.2. Permission(string, string)

Creates a permission with the given service and name, target is Default

public Permission(string service, string name)

21.130.4.2.1. Parameters

service string

Service

name string

Name

21.130.4.3. Permission(string, string, string?)

Creates a permission with the given service, name and target

public Permission(string service, string name, string? target)

21.130.4.3.1. Parameters

service string

Service

name string

Name

target string?

Target, if null defaults to Default

21.130.5. Fields

21.130.5.1. Claim

C# Claim object equivalent to this permission

public readonly Claim Claim

21.130.5.1.1. Field Value

Claim

21.130.5.2. Name

Name of the permission, usually the affected method

public readonly string Name

21.130.5.2.1. Field Value

string

21.130.5.3. Separator

Separator used in permission strings

public const char Separator = ':'

21.130.5.3.1. Field Value

char

21.130.5.4. Service

Service targeted by the permission

public readonly string Service

21.130.5.4.1. Field Value

string

21.130.5.5. Target

target scope of the permission (All, self…)

public readonly string Target

21.130.5.5.1. Field Value

string

21.130.6. Methods

21.130.6.1. Equals(Permission?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Permission? other)

21.130.6.1.1. Parameters

other Permission?

An object to compare with this object.

21.130.6.1.2. Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

21.130.6.2. Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

21.130.6.2.1. Parameters

obj object?

The object to compare with the current object.

21.130.6.2.2. Returns

bool

true if the specified object is equal to the current object; otherwise, false.

21.130.6.3. GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

21.130.6.3.1. Returns

int

A hash code for the current object.

21.130.6.4. ToBasePermission()

Base permission string of the permission (service:name)

public string ToBasePermission()

21.130.6.4.1. Returns

string

The base permission string of this permission, no target

21.130.6.5. ToString()

String representation of the permission

public override string ToString()

21.130.6.5.1. Returns

string

Returns the full permission string

21.130.7. Operators

21.130.7.1. operator ==(Permission?, Permission?)

Equality operator, see

public static bool operator ==(Permission? left, Permission? right)

21.130.7.1.1. Parameters

left Permission?

left side Permission

right Permission?

right side Permission

21.130.7.1.2. Returns

bool

true if left is equal to right, false otherwise

21.130.7.2. operator !=(Permission?, Permission?)

Inequality operator, see

public static bool operator !=(Permission? left, Permission? right)

21.130.7.2.1. Parameters

left Permission?

left side Permission

right Permission?

right side Permission

21.130.7.2.2. Returns

bool

false if left is equal to right, true otherwise