Class UnifiedPermissionService
- Namespace
- Dynamicweb.Security.Permissions
- Assembly
- Dynamicweb.Security.dll
Handles everything related to working with permissions in the system.
public class UnifiedPermissionService
- Inheritance
-
UnifiedPermissionService
- Inherited Members
Methods
ClearUserCache(string)
Clears the cache for specified id.
public void ClearUserCache(string id)
Parameters
id
string- Id of group or user
DeleteAllPermissionsByQuery(UnifiedPermissionQuery)
Deletes all permissions for the specified userid and query.
public void DeleteAllPermissionsByQuery(UnifiedPermissionQuery query)
Parameters
query
UnifiedPermissionQuery- Target of permission
Remarks
Will remove cached permissions
DeletePermission(string, UnifiedPermissionIdentifier)
Deletes all permissions for the specified userid and query.
public void DeletePermission(string userId, UnifiedPermissionIdentifier identifier)
Parameters
userId
string- Id of user
identifier
UnifiedPermissionIdentifier- Target of permission
GetAllMatchingKeys<T>(string, PermissionLevel)
Gets all keys for permissions on the specific object type for the specified userid.
public HashSet<string> GetAllMatchingKeys<T>(string userId, PermissionLevel minimum = PermissionLevel.Read) where T : IPermissionControlled, new()
Parameters
userId
string- UserId for permission lookup
minimum
PermissionLevel- Minimum permission level needed to be included in search
Returns
Type Parameters
T
- Objecttype to get permissions for
GetAllPermissionsByQuery(UnifiedPermissionQuery)
Gets all permissions matching the specified userId and query.
public IList<UnifiedPermission> GetAllPermissionsByQuery(UnifiedPermissionQuery query)
Parameters
query
UnifiedPermissionQuery- Target of permission
Returns
Remarks
UserId == null means that userid is not part of the query. Will not use a cache.
GetPermission(string, UnifiedPermissionIdentifier, PermissionLevel)
Retrieves the permission level for the specified user and query.
public PermissionLevel GetPermission(string userId, UnifiedPermissionIdentifier identifier, PermissionLevel defaultPermission = PermissionLevel.None)
Parameters
userId
string- Id of user
identifier
UnifiedPermissionIdentifier- Target of permission
defaultPermission
PermissionLevel- The permission level to use, if no permission was configured for the identifier
Returns
SetPermission(string, UnifiedPermissionIdentifier, PermissionLevel)
Sets permissions for the specified userid and query.
public void SetPermission(string userId, UnifiedPermissionIdentifier identifier, PermissionLevel permission)
Parameters
userId
string- Id of user
identifier
UnifiedPermissionIdentifier- Target of permission
permission
PermissionLevel- Permission level
TryGetPermission(PermissionPriorityQueue<string>, UnifiedPermissionIdentifier, ref PermissionLevel?)
Retrieves the permission level closest to the top of the permission queue. If multiple permissions recide on the same level, these will be consolidated to one result.
public bool TryGetPermission(PermissionPriorityQueue<string> permissionPriorities, UnifiedPermissionIdentifier identifier, ref PermissionLevel? permissionLevel)
Parameters
permissionPriorities
PermissionPriorityQueue<string>- Permission queue
identifier
UnifiedPermissionIdentifierpermissionLevel
PermissionLevel?
Returns
UseNewPermission()
Defines if new or old permission model should be used.
public static bool UseNewPermission()