Skip to content

LogicOperatorPermissionService class

namespace: Serenity.Web   assemblySerenity.Net.Core

Decorates an IPermissionService to support logical operators (!, &, |, parentheses) in permission expressions.

public class LogicOperatorPermissionService : IPermissionService, ITransientGrantor
parameter description
permissionService The underlying permission service to delegate simple permission checks to.

Public Members

name description
LogicOperatorPermissionService(…) Decorates an IPermissionService to support logical operators (!, &, |, parentheses) in permission expressions.
GetGranted()
Grant(…)
GrantAll()
HasPermission(…) Determines whether the current user has the specified permission or satisfies the given logical permission expression.
IsAllGranted()
UndoGrant()

Remarks

Register this decorator at application startup to enable expressions such as PermissionA & !PermissionB.

registrar.RegisterInstance<IPermissionService>(new LogicOperatorPermissionService(new MyPermissionService()))

Creates a new instance of the LogicOperatorPermissionService class wrapping the specified permission service.

See Also