Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I have a WindowController that is targeting WindowType.Main in order to hide navigation items based on security permissions. It contains:

                                    [C#]
                                    bool permission = SecuritySystem.IsGranted( new ClientPermissionRequest(typeof(Employee), null, null, SecurityOperations.Read));

                                    While using version 15.1.3 (which was installed for only a few hours) I was seeing a compiler warning saying that ClientPermissionRequest was obsolete and I should instead use PermissionRequest. I am now using 15.1.4 but no longer seeing that warning. Is that method obsolete or not?

                                    If ClientPermissionRequest is obsolete, how can I test permissions? When I attempted to use PermissionRequest I found that all three overloads have an ObjectSpace parameter, but there is no ObjectSpace property available in a WindowController.

                                    Thank you,
                                    Mark

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Mark,

                                The ClientPermissionRequest class is marked with the Obsolete attribute in 15.2.4. It is unclear why you do not see a warning - probably there is a Visual Studio issue.
                                Use the PermissionRequest class to test permissions. The only required parameters of its constructor are objectType and operation. If you want to test type permissions, use these parameters. Passing an Object Space instance is not required. If you need to test permissions for a certain object, pass the Object Space by which this object was loaded.

                                Please see an example in the Access the Security System in Code topic:
                                [C#]

                                Please let me know if you need further assistance.

                                • Mark Davison 2 12.10.2015

                                  Anatol,
                                  The only documentation for ClientPermission that I can find is the metadata furnished by Visual Studio:
                                  #region Assembly DevExpress.ExpressApp.v15.2.dll, v15.2.4.0
                                  // C:\Program Files (x86)\DevExpress 15.2\Components\Bin\Framework\DevExpress.ExpressApp.v15.2.dll
                                  #endregion
                                  using DevExpress.ExpressApp;
                                  using System;
                                  namespace DevExpress.ExpressApp.Security {
                                   public class PermissionRequest : IPermissionRequest {
                                     public PermissionRequest(IObjectSpace objectSpace, Type objectType, string operation);
                                     public PermissionRequest(IObjectSpace objectSpace, Type objectType, string operation, object targetObject);
                                     public PermissionRequest(IObjectSpace objectSpace, Type objectType, string operation, object targetObject, string memberName);
                                     public string MemberName { get; set; }
                                     public IObjectSpace ObjectSpace { get; set; }
                                     public Type ObjectType { get; set; }
                                     public string Operation { get; set; }
                                     public object TargetObject { get; set; }
                                     public object GetHashObject();
                                   }
                                  }
                                  That's the end of the "documentation." Determining how to use a method by making empirical tests or reading source code is extremely time-consuming.
                                  Your comment "Passing an Object Space instance is not required" caused me to try:
                                  new PermissionRequest(null,typeof(Employee),SecurityOperations.Read))
                                  Please confirm that this is correct.
                                  Thank you,
                                  Mark

                                • Anatol (DevExpress Support) 12.10.2015

                                  This documentation is not ready yet. We will definitely describe this class in the future. Please accept our apologies for the inconvenience.
                                  Your code is correct.

                                • Fitzroy F. Wright 04.22.2016

                                  I am still trying to figure this out

                                  [C#]
                                  bool isPermitted = SecuritySystem.IsGranted(new ClientPermissionRequest(typeof(DeliveryOrderDetail), "Returned", null, SecurityOperations.Write));

                                  "Returned" is a field of the DeliveryOrderDetail Type.
                                  How do I use PermissionRequest Here
                                  I am checking if the user has permission to update a particular field.

                                • Anatol (DevExpress Support) 04.22.2016

                                  Please see an example in the Access the Security System in Code topic:

                                  [C#]
                                  bool isPermitted = SecuritySystem.IsGranted(new PermissionRequest(ObjectSpace, typeof(DeliveryOrderDetail), "Returned", null, SecurityOperations.Write));