Skip to main content
.NET Framework 4.5.2+

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

NuGet Package: DevExpress.ExpressApp

Declaration

object GetHashObject()

Returns

Type Description
Object

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

Remarks

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