Back to Devexpress

IsGrantedExtensions.CanExecute(IRequestSecurityStrategy, String) Method

expressappframework-devexpress-dot-expressapp-dot-security-dot-isgrantedextensions-dot-canexecute-x28-devexpress-dot-expressapp-dot-security-dot-irequestsecuritystrategy-system-dot-string-x29.md

latest2.5 KB
Original Source

IsGrantedExtensions.CanExecute(IRequestSecurityStrategy, String) Method

Checks whether the current user can execute the specified Action.

Namespace : DevExpress.ExpressApp.Security

Assembly : DevExpress.ExpressApp.Security.v25.2.dll

NuGet Package : DevExpress.ExpressApp.Security

Declaration

csharp
public static bool CanExecute(
    this IRequestSecurityStrategy security,
    string actionId
)
vb
<ExtensionAttribute>
Public Shared Function CanExecute(
    security As IRequestSecurityStrategy,
    actionId As String
) As Boolean

Parameters

NameTypeDescription
securityIRequestSecurityStrategy

An object that specifies the application’s security strategy.

| | actionId | String |

The Action identifier.

|

Returns

TypeDescription
Boolean

true, if the current user can execute the specified Action; otherwise, false.

|

Remarks

csharp
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
// ...
public class CheckActionPermissionController : ViewController<ListView> {
    protected override void OnActivated() {
        base.OnActivated();
        SecurityStrategy securityStrategy = Application.GetSecurityStrategy();
        if (!securityStrategy.CanExecute("CustomAction")) {
            // ...  
        }
    }
}

You can find an Action’s identifier in the Model Editor:

See Also

IsGrantedExtensions Class

IsGrantedExtensions Members

DevExpress.ExpressApp.Security Namespace