Back to Devexpress

IsGrantedExtensions.CanWrite<T>(IRequestSecurityStrategy, IObjectSpace, String) Method

expressappframework-devexpress-dot-expressapp-dot-security-dot-isgrantedextensions-dot-canwrite-1-x28-devexpress-dot-expressapp-dot-security-dot-irequestsecuritystrategy-devexpress-dot-expressapp-dot-iobjectspace-system-dot-string-x29.md

latest3.2 KB
Original Source

IsGrantedExtensions.CanWrite<T>(IRequestSecurityStrategy, IObjectSpace, String) Method

Checks whether the current user can write objects of the specified type. If the optional memberName parameter is specified, the method checks whether the current user can write the specified object members.

Namespace : DevExpress.ExpressApp.Security

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

NuGet Package : DevExpress.ExpressApp.Security

Declaration

csharp
public static bool CanWrite<T>(
    this IRequestSecurityStrategy security,
    IObjectSpace objectSpace,
    string memberName = null
)
vb
<ExtensionAttribute>
Public Shared Function CanWrite(Of T)(
    security As IRequestSecurityStrategy,
    objectSpace As IObjectSpace,
    memberName As String = Nothing
) As Boolean

Parameters

NameTypeDescription
securityIRequestSecurityStrategy

An object that specifies the application’s security strategy.

| | objectSpace | IObjectSpace |

An Object Space used to obtain data to calculate this security criterion.

|

Optional Parameters

NameTypeDefaultDescription
memberNameStringnull

A name of the object member to check.

|

Type Parameters

NameDescription
T

An object type.

|

Returns

TypeDescription
Boolean

true, if the current user can write objects of the specified type or the specified object members; otherwise, false.

|

Remarks

csharp
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
// ...
public class CheckWritePermissionController : ObjectViewController<ListView, Contact> {
    protected override void OnActivated() {
        base.OnActivated();
        SecurityStrategy securityStrategy = Application.GetSecurityStrategy();
        if (!securityStrategy.CanWrite<Department>(ObjectSpace, nameof(Department.Office))) {
            // ...
        }
    }
}

See Also

IsGrantedExtensions Class

IsGrantedExtensions Members

DevExpress.ExpressApp.Security Namespace