I am trying to use SecuritySystem.IsGranted with ObjectAccessPermission, i used this code:
SecuritySystem.IsGranted(new ObjectAccessPermission(typeof(CustomerRefund), ObjectAccess.Create))
But it turn out it always returns true!
I searched the support center and i found this ticket which state exactly my issue: http://www.devexpress.com/Support/Center/p/Q364912.aspx
The support in this ticket suggested this code to be used instead:
SecuritySystem.IsGranted(new TypeOperationPermissionRequest(typeof(Role), SecurityOperations.Navigate));
But i could not find TypeOperationPermissionRequest, so i searched again, and found this: http://www.devexpress.com/Support/Center/p/Q424611.aspx
And it did not help.
Can you please provide me with the proper code for this.
With the new security system, use the ClientPermissionRequest class instead of the deprecated TypeOperationPermissionRequest one. For instance, your updated code may look like this:
SecuritySystem.IsGranted(new ClientPermissionRequest(typeof(CustomerRefund), null, null, SecurityOperations.Create))
You may also find methods of the helper DevExpress.ExpressApp.DataManipulationRight class extremely helpful, as it provides methods for most common situations.