Back to Devexpress

SecuritySystem.IsGranted(IPermissionRequest) Method

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

latest4.8 KB
Original Source

SecuritySystem.IsGranted(IPermissionRequest) Method

Checks whether or not the current user is allowed to execute the specified secured operation.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public static bool IsGranted(
    IPermissionRequest permissionRequest
)
vb
Public Shared Function IsGranted(
    permissionRequest As IPermissionRequest
) As Boolean

Parameters

NameTypeDescription
permissionRequestIPermissionRequest

An IPermissionRequest object that specifies the secured operation.

|

Returns

TypeDescription
Boolean

true , if the user can execute the secured operation; otherwise - false.

|

Remarks

You can also use the IsGrantedExtensions class methods to check if the current user is allowed to execute the specified secured operation. These methods do not require an IPermissionRequest object.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsGranted(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#L18

csharp
exportController.Active.SetItemValue("Security",
        SecuritySystem.IsGranted(new ExportPermissionRequest(View.ObjectTypeInfo.Type)));
}

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

csharp
controller.Active.SetItemValue("Security",
        SecuritySystem.IsGranted(new ExportPermissionRequest()));
}

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

vb
If TypeOf SecuritySystem.Instance Is IRequestSecurity Then
    exportController.Active.SetItemValue("Security", SecuritySystem.IsGranted(New ExportPermissionRequest(View.ObjectTypeInfo.Type)))
End If

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

vb
If TypeOf SecuritySystem.Instance Is IRequestSecurity Then
    controller.Active.SetItemValue("Security", SecuritySystem.IsGranted(New ExportPermissionRequest()))
End If

See Also

Use the Security System

SecuritySystem Class

SecuritySystem Members

DevExpress.ExpressApp Namespace