Skip to main content
All docs
V25.1
  • .NET Framework 4.6.2+

    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.1.dll

    Declaration

    public static bool CanWrite<T>(
        this IRequestSecurityStrategy security,
        IObjectSpace objectSpace,
        string memberName = null
    )

    Parameters

    Name Type Description
    security IRequestSecurityStrategy

    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

    Name Type Default Description
    memberName String null

    A name of the object member to check.

    Type Parameters

    Name Description
    T

    An object type.

    Returns

    Type Description
    Boolean

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

    Remarks

    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