Table of Contents

Class PermissionService

Namespace
Dynamicweb.Security.Permissions
Assembly
Dynamicweb.Core.dll

Handles fetching, adding, updating and removing permissions in the system.

public sealed class PermissionService : ICacheStorage<string, ConcurrentDictionary<PermissionEntityIdentifier, Permission>>, ICacheStorage<string>, ICacheStorage
Inheritance
PermissionService
Implements
Inherited Members

Methods

ClearCache()

Clears the cache for all permissions.

public void ClearCache()

ClearCacheByOwnerId(string)

Clears the cache for specified permission owner id.

public void ClearCacheByOwnerId(string ownerId)

Parameters

ownerId string

Id of the permission owner

GetExplicitPermissionInfos(IPermissionEntity)

Gets permission info for all explicit permissions for the specified entity.

public IEnumerable<PermissionInfo> GetExplicitPermissionInfos(IPermissionEntity entity)

Parameters

entity IPermissionEntity

Permission entity

Returns

IEnumerable<PermissionInfo>

Permission infos

GetExplicitPermissionInfos(PermissionEntityIdentifier)

Gets permission info for all explicit permissions matching the identifier.

public IEnumerable<PermissionInfo> GetExplicitPermissionInfos(PermissionEntityIdentifier identifier)

Parameters

identifier PermissionEntityIdentifier

Permission entity identifier

Returns

IEnumerable<PermissionInfo>

Permission infos

GetInheritedPermissionInfos(IPermissionEntity)

Gets permission info for all permissions inherited from parent entities for the specified entity.

public IEnumerable<PermissionInfo> GetInheritedPermissionInfos(IPermissionEntity entity)

Parameters

entity IPermissionEntity

Permission entity

Returns

IEnumerable<PermissionInfo>

Permission infos

GetInheritedPermissionInfos(PermissionEntityIdentifier)

Gets permission info for all inherited permissions matching the identifier.

public IEnumerable<PermissionInfo> GetInheritedPermissionInfos(PermissionEntityIdentifier identifier)

Parameters

identifier PermissionEntityIdentifier

Permission entity identifier

Returns

IEnumerable<PermissionInfo>

Permission infos

GetPermission(string, PermissionEntityIdentifier)

Gets a permission for the specified owner and entity identifier.

public Permission GetPermission(string ownerId, PermissionEntityIdentifier identifier)

Parameters

ownerId string

Permission owner id

identifier PermissionEntityIdentifier

Permission entity identifier

Returns

Permission

Permission, if found; otherwise, null

GetPermissionInfos(PermissionEntityIdentifier)

Gets permission info for all permissions matching the identifier (explicit, inherited and default permissions).

public IEnumerable<PermissionInfo> GetPermissionInfos(PermissionEntityIdentifier identifier)

Parameters

identifier PermissionEntityIdentifier

Permission entity identifier

Returns

IEnumerable<PermissionInfo>

Permission infos

GetPermissionsByName(string, string)

Gets all permissions matching the specified name for a given permission owner.

public IEnumerable<Permission> GetPermissionsByName(string ownerId, string name)

Parameters

ownerId string

Permission owner identifier

name string

Permission name

Returns

IEnumerable<Permission>

All permissions matching the owner and name.

GetPermissionsByName(string, string, string)

Gets all permissions matching the specified name and subName for a given permission owner.

public IEnumerable<Permission> GetPermissionsByName(string ownerId, string name, string subName)

Parameters

ownerId string

Permission owner identifier

name string

Permission name

subName string

Permission subname

Returns

IEnumerable<Permission>

All permissions matching the owner, name and subname.

GetPermissionsByQuery(PermissionQuery)

Gets all permissions matching the specified query.

public IEnumerable<Permission> GetPermissionsByQuery(PermissionQuery query)

Parameters

query PermissionQuery

Permission query

Returns

IEnumerable<Permission>

Permissions matching the specified query.

RemovePermission(Permission)

Removes a given permission.

public void RemovePermission(Permission permission)

Parameters

permission Permission

Permission to remove

RemovePermission(string, PermissionEntityIdentifier)

Removes all permissions for the specified owner and identifier.

public void RemovePermission(string ownerId, PermissionEntityIdentifier identifier)

Parameters

ownerId string

Identifier of owner

identifier PermissionEntityIdentifier

Identifier of entity

RemovePermissionsByQuery(PermissionQuery)

Removes all permissions for the specified query.

public void RemovePermissionsByQuery(PermissionQuery query)

Parameters

query PermissionQuery

Target of permission

SetPermission(Permission)

Sets a given permission.

public void SetPermission(Permission permission)

Parameters

permission Permission

Permission to set

SetPermission(string, PermissionEntityIdentifier, PermissionLevel)

Sets permission level for the specified owner and identifier.

public void SetPermission(string ownerId, PermissionEntityIdentifier identifier, PermissionLevel level)

Parameters

ownerId string

Identifier of owner

identifier PermissionEntityIdentifier

Identifier of entity

level PermissionLevel

Permission level

SetPermissionsByQuery(PermissionQuery, PermissionLevel)

Removes all permissions for the specified query.

public void SetPermissionsByQuery(PermissionQuery query, PermissionLevel level)

Parameters

query PermissionQuery

Target of permission

level PermissionLevel

TryGetPermission(string, PermissionEntityIdentifier, out Permission)

Tries to get a permission for the specified owner and entity identifier.

public bool TryGetPermission(string ownerId, PermissionEntityIdentifier identifier, out Permission permission)

Parameters

ownerId string

Permission owner id

identifier PermissionEntityIdentifier

Permission entity identifier

permission Permission

Permission

Returns

bool

true, if permission was found; otherwise, false

To top