Class Permissions
inherit from this class and define your applications permissions as public const string
public const string Inventory_Create_Item = "100";
public const string Inventory_Retrieve_Item = "101";
public const string Inventory_Update_Item = "102";
public const string Inventory_Delete_Item = "103";
Inherited Members
Namespace: FastEndpoints.Security
Assembly: FastEndpoints.Security.dll
Syntax
public abstract class Permissions : IEnumerable<(string PermissionName, string PermissionCode)>, IEnumerable
Constructors
Permissions()
Declaration
protected Permissions()
Methods
AllCodes()
get a list of all permission codes
Declaration
public IEnumerable<string> AllCodes()
Returns
Type | Description |
---|---|
IEnumerable<string> |
AllNames()
get a list of all permission names
Declaration
public IEnumerable<string> AllNames()
Returns
Type | Description |
---|---|
IEnumerable<string> |
CodesFor(IEnumerable<string>)
get a list of permission codes for a given list of permission names
Declaration
public IEnumerable<string> CodesFor(IEnumerable<string> names)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | names | the permission names to get the codes for |
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<(string PermissionName, string PermissionCode)> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<(string PermissionName, string PermissionCode)> | An enumerator that can be used to iterate through the collection. |
NamesFor(IEnumerable<string>)
gets a list of permission names for the given list of permission codes
Declaration
public IEnumerable<string> NamesFor(IEnumerable<string> codes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | codes | the permission codes to get the permission names for |
Returns
Type | Description |
---|---|
IEnumerable<string> |
PermissionFromCode(string)
get the permission tuple using it's code. returns null if not found
Declaration
public (string PermissionName, string PermissionCode)? PermissionFromCode(string permissionCode)
Parameters
Type | Name | Description |
---|---|---|
string | permissionCode | code of the permission to get |
Returns
Type | Description |
---|---|
(string PermissionName, string PermissionCode)? |
PermissionFromName(string)
get the permission tuple using it's name. returns null if not found
Declaration
public (string PermissionName, string PermissionCode)? PermissionFromName(string permissionName)
Parameters
Type | Name | Description |
---|---|---|
string | permissionName | name of the permission |
Returns
Type | Description |
---|---|
(string PermissionName, string PermissionCode)? |