Skip to content

TransientGrantingPermissionService class

namespace: Serenity.Web   assemblySerenity.Net.Core

Decorates an IPermissionService to support temporarily granting permissions.

public class TransientGrantingPermissionService : IPermissionService, ITransientGrantor
parameter description
permissionService The underlying permission service to delegate to when no transient grant is active.
requestContext The accessor that provides per-request storage for the granting stack.

Public Members

name description
TransientGrantingPermissionService(…) Decorates an IPermissionService to support temporarily granting permissions.
GetGranted()
Grant(…) Temporarily grants the specified permissions.
GrantAll() Temporarily grants all permissions.
HasPermission(…) Determines whether the current user has the specified permission, taking transient grants into account.
IsAllGranted()
UndoGrant() Reverts the most recent Grant or GrantAll operation.

Remarks

Register this decorator at application startup to enable temporary permission grants.

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

Creates a new instance of the TransientGrantingPermissionService class wrapping the specified service.

See Also