Ticket T152763
Visible to All Users

Calculate from SecuredObjectSpaceProvider's objects

created 10 years ago

Hello,

In order to disable the whole row of protected content in listview, I used the SecuredObjectSpaceProvider instead of XPObjectSpaceProvider.

//protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        //{
        //    args.ObjectSpaceProvider = new XPObjectSpaceProvider(args.ConnectionString, args.Connection);
        //}

protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            args.ObjectSpaceProvider = new SecuredObjectSpaceProvider(
                (SecurityStrategy)Security, args.ConnectionString, args.Connection);
        }

But now the problem is if the user do not have SecuritySystemObjectPermissionsObject of some object. the calculation should include them will not get the right answer.

Please find the attached screenshot.

Or, Is their other way to hide the entire row of Protected Content in listview?

Thanks
Wangbei

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Wangbei,

To filter these records, create a ViewController and add a filter to the ListView.CollectionSource.Criteria property based on object permissions assigned to the current user. To get the current user object, use the SecuritySystem.CurrentUser static property. Refer to the Criteria Property of a List View's Collection Source topic for additional information.

Alternatively, you can use the workaround suggested by Dennis in the SecurityStrategyComplex: How to modify objects/properties in code when the user does not have the permission? ticket to calculate values using protected properties when the Integrated Security is used.

    Show previous comments (10)
    Anatol (DevExpress) 10 years ago

      I have updated your project. Now it recalculates the total value only in the non-secured UnitOfWork and preserves the value in the database. As I imagined, there is an issue with updating the total value. I have resolved it using a controller - RefreshPayCardController.
      I hope you will find this solution suitable.

        Hello Anatol,
        It's really fantastic. Thanks.
        BRGDS/Wangbei

        Anatol (DevExpress) 10 years ago

          You are welcome!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.