Interface IAuthorization
The interface defines the authorization pattern used to check if a user is able to do an operation or not. The methods are based on Azman and Role base model See msdn for azman documentation.
public interface IAuthorization
Properties
AuthorizationType
Gets the type of the authorization.
string AuthorizationType { get; }
Property Value
- string
The type of the authorization.
Methods
IsAuthorized(params int[])
Determines whether the specified operations are authorized.
bool IsAuthorized(params int[] operations)
Parameters
operationsint[]The operations.
Returns
- bool
trueif the specified operations is authorized; otherwise,false.
IsAuthorized(string)
Determines whether the specified operation is authorized in the default (empty) scope.
bool IsAuthorized(string operation)
Parameters
operationstringThe operation name.
Returns
- bool
trueif the specified operation is authorized; otherwise,false.
Remarks
This overload exists so that IsAuthorized("Name") compiles: without it, a single string argument
matches both IsAuthorized(string, params int[]) and IsAuthorized(string, params string[])
with an empty operations array, which is ambiguous.
IsAuthorized(string, params int[])
Determines whether the specified operations are authorized in the specified scope.
bool IsAuthorized(string scope, params int[] operations)
Parameters
Returns
- bool
trueif the specified scope is authorized; otherwise,false.
IsAuthorized(string, params string[])
Determines whether the specified operations are authorized in the specified scope.
bool IsAuthorized(string scope, params string[] operations)
Parameters
Returns
- bool
trueif the specified scope is authorized; otherwise,false.
IsAuthorized(params string[])
Determines whether the specified operations are authorized.
bool IsAuthorized(params string[] operations)
Parameters
operationsstring[]The operations.
Returns
- bool
trueif the specified operations is authorized; otherwise,false.
IsInRole(string)
Determines whether the user is defined in the specified role.
bool IsInRole(string role)
Parameters
rolestringThe role.
Returns
- bool
trueif [is in role] [the specified role]; otherwise,false.
IsInRole(string, string)
/// Determines whether the user is defined in the specified role for the specific scope.
bool IsInRole(string scope, string role)
Parameters
Returns
- bool
trueif [is in role] [the specified scope]; otherwise,false.
Operations()
Operations defined.
string[] Operations()
Returns
- string[]
Operations(string)
Operations defined in the specified scope.
string[] Operations(string scope)
Parameters
scopestringThe scope.
Returns
- string[]
Roles()
Roleses defined.
string[] Roles()
Returns
- string[]
Roles(string)
Roleses defined in the specified scope.
string[] Roles(string scope)
Parameters
scopestringThe scope.
Returns
- string[]
Scopes()
Scopeses for roles and operations.
string[] Scopes()
Returns
- string[]