Class PermissionContext
- Namespace
- Dynamicweb.Security.Permissions
- Assembly
- Dynamicweb.Core.dll
Provides context information for permission checks.
public class PermissionContext : IDisposable
- Inheritance
-
PermissionContext
- Implements
- Inherited Members
Properties
Current
Gets the current permission context.
public static PermissionContext Current { get; }
Property Value
- PermissionContext
permissionContext
Methods
AnonymousContext()
Creates a permission context for an anonymous user in the current execution context (frontend/backend).
public static PermissionContext AnonymousContext()
Returns
- PermissionContext
Permission context
BackendUserContext(User?)
Creates a permission context for a backend user.
public static PermissionContext BackendUserContext(User? user)
Parameters
user
UserBackend user
Returns
- PermissionContext
Permission context
Remarks
If user is null (not authenticated) then it returns the default context which defaults to None
Dispose()
Performs application-defined tasks associated with freeing, releasing or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
ElevatedContext()
Creates a permission context that explicitly allows everything.
public static PermissionContext ElevatedContext()
Returns
- PermissionContext
permissionContext
FrontendAnonymousContext()
Creates a permission context for an anonymous frontend user (not authenticated).
public static PermissionContext FrontendAnonymousContext()
Returns
- PermissionContext
Permission context
FrontendUserContext(User?)
Creates a permission context for a frontend user.
public static PermissionContext FrontendUserContext(User? user)
Parameters
user
UserFrontend user
Returns
- PermissionContext
Permission context
Remarks
If the user is null (not authenticated) then it returns the anonymous context
UserContext(User?)
Creates a permission context for specified user in the current execution context (frontend/backend).
public static PermissionContext UserContext(User? user)
Parameters
user
UserUser
Returns
- PermissionContext
Permission context
Remarks
If the user is null (not authenticated) then it returns the anonymous context.