Interface ISecurityDescriptor
The interface for a Security descriptor, i e something that allows for checking access rights.
Namespace: EPiServer.Security
Assembly: EPiServer.BaseLibrary.dll
Version: 8.11.0Syntax
public interface ISecurityDescriptor
Methods
GetAccessLevel(IPrincipal)
Retreives the access level for the specified principal.
Declaration
AccessLevel GetAccessLevel(IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal get access rights for. |
Returns
Type | Description |
---|---|
AccessLevel | The access level that the specified principal has. |
Remarks
Use this method when you want to get the union of all access types granted to this principal. This is most likely only used for display purposes in the user interface. Code that checks access and performs different actions depending on the type of access granted should use the HasAccess method, since it does what you want and has the potential for being much faster.
If the current ISecurityDescriptor is inherited, this method checks the inherited access rights.
HasAccess(IPrincipal, AccessLevel)
Determines whether the specified principal has the requested access.
Declaration
bool HasAccess(IPrincipal principal, AccessLevel access)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal to authorize. |
AccessLevel | access | The requested access level. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
Note that the access level is a bitmask, i.e. we simply check that all specified access types are granted to the principal.
If the current ISecurityDescriptor is inherited, this method will check the inherited access rights.