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

17.132.1. Inheritance

objectPermission

17.132.2. Implements

IEquatable<Permission>

17.132.3. Inherited Members

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

17.132.4. Constructors

17.132.4.1. Permission(string)

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

public Permission(string actionString)

17.132.4.1.1. Parameters

actionString string

String representation of the permission

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

17.132.4.2. Permission(string, string)

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

public Permission(string service, string name)

17.132.4.2.1. Parameters

service string

Service

name string

Name

17.132.4.3. Permission(string, string, string?)

Creates a permission with the given service, name and target

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

17.132.4.3.1. Parameters

service string

Service

name string

Name

target string?

Target, if null defaults to Default

17.132.5. Fields

17.132.5.1. Claim

C# Claim object equivalent to this permission

public readonly Claim Claim

17.132.5.1.1. Field Value

Claim

17.132.5.2. Name

Name of the permission, usually the affected method

public readonly string Name

17.132.5.2.1. Field Value

string

17.132.5.3. Separator

Separator used in permission strings

public const char Separator = ':'

17.132.5.3.1. Field Value

char

17.132.5.4. Service

Service targeted by the permission

public readonly string Service

17.132.5.4.1. Field Value

string

17.132.5.5. Target

target scope of the permission (All, self…)

public readonly string Target

17.132.5.5.1. Field Value

string

17.132.6. Methods

17.132.6.1. Equals(Permission?)

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

public bool Equals(Permission? other)

17.132.6.1.1. Parameters

other Permission?

An object to compare with this object.

17.132.6.1.2. Returns

bool

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

17.132.6.2. Equals(object?)

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

public override bool Equals(object? obj)

17.132.6.2.1. Parameters

obj object?

The object to compare with the current object.

17.132.6.2.2. Returns

bool

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

17.132.6.3. GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

17.132.6.3.1. Returns

int

A hash code for the current object.

17.132.6.4. ToBasePermission()

Base permission string of the permission (service:name)

public string ToBasePermission()

17.132.6.4.1. Returns

string

The base permission string of this permission, no target

17.132.6.5. ToString()

String representation of the permission

public override string ToString()

17.132.6.5.1. Returns

string

Returns the full permission string

17.132.7. Operators

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

Equality operator, see

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

17.132.7.1.1. Parameters

left Permission?

left side Permission

right Permission?

right side Permission

17.132.7.1.2. Returns

bool

true if left is equal to right, false otherwise

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

Inequality operator, see

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

17.132.7.2.1. Parameters

left Permission?

left side Permission

right Permission?

right side Permission

17.132.7.2.2. Returns

bool

false if left is equal to right, true otherwise