IPermissionRequest.GetHashObject() Method

Returns an object which is unique for each set of IPermissionRequest object's property values.

Namespace: DevExpress.ExpressApp.Security

Assembly: DevExpress.ExpressApp.v18.1.dll

Declaration

object GetHashObject()
Function GetHashObject As Object

Returns

Type Description
Object

An object which is unique for each set of Permission Request property values.

The GetHashObject method implementation should satisfy the following requirements:

  • a returned object should be serializable;
  • a returned object should be the same for different IPermissionRequest instances with the same set of property values.

Generally, a combination of Permission Request property values can be used to calculate the unique hash object.

public class CustomOperationPermissionRequest : IPermissionRequest {
    public string Operation { get; set; }
    public Type ObjectType { get; private set; }
    public object GetHashObject() {
        return string.Format("{0}-{1}", ObjectType.FullName, Operation);
    }
}

In the simplest case, when your custom Permission Request exposes no properties, you can return the current object type.

public class MyPermissionRequest : IPermissionRequest {
    public object GetHashObject() {
        return this.GetType().FullName;
    }
}

See Also