Back to Devexpress

SecuritySystem.Demand(IPermissionRequest) Method

expressappframework-devexpress-dot-expressapp-dot-securitysystem-dot-demand-x28-devexpress-dot-expressapp-dot-security-dot-ipermissionrequest-x29.md

latest4.8 KB
Original Source

SecuritySystem.Demand(IPermissionRequest) Method

Throws a SecurityException exception when the current user is allowed to execute a particular secured operation.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public static void Demand(
    IPermissionRequest permissionRequest
)
vb
Public Shared Sub Demand(
    permissionRequest As IPermissionRequest
)

Parameters

NameTypeDescription
permissionRequestIPermissionRequest

An IPermissionRequest object that specifies the secured operation.

|

Remarks

The passed Permission Request should have an appropriate Permission Request Processor registered within Security Strategy. To register a Permission Request, handle the SecurityStrategy.CustomizeRequestProcessors event. Refer to the How to: Implement Custom Security Objects (Users, Roles, Operation Permissions) topic to see an example.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Demand(IPermissionRequest) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/CS/CustomSecurityOperation.Module/Controllers/SecuredExportController.cs#L23

csharp
void ExportAction_Executing(object sender, System.ComponentModel.CancelEventArgs e) {
    SecuritySystem.Demand(new ExportPermissionRequest(View.ObjectTypeInfo.Type));
}

XAF-implement-custom-permission-role-and-user-objects/CS/SecuredExportExample.Module/Controllers/SecuredExportController.cs#L23

csharp
void ExportAction_Executing(object sender, System.ComponentModel.CancelEventArgs e) {
    SecuritySystem.Demand(new ExportPermissionRequest());
}

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/VB/CustomSecurityOperation.Module/Controllers/SecuredExportController.vb#L23

vb
Private Sub ExportAction_Executing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
    SecuritySystem.Demand(New ExportPermissionRequest(View.ObjectTypeInfo.Type))
End Sub

XAF-implement-custom-permission-role-and-user-objects/VB/SecuredExportExample.Module/Controllers/SecuredExportController.vb#L24

vb
Private Sub ExportAction_Executing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
    SecuritySystem.Demand(New ExportPermissionRequest())
End Sub

See Also

SecuritySystem Class

SecuritySystem Members

DevExpress.ExpressApp Namespace