Bug Report Q363027
Visible to All Users
Duplicate

Security.DC - Intermediate entities for many-to-many associations are not registered, and access to them is denied

created 13 years ago

I've just run into an issue with my simple app that prevents me from saving objects that inherent from other objects with the error:
"You can not save the 'DevExpress.ExpressApp.DC.GeneratedClasses.IAwardData_Data_Matter(**guid**)' object due to security restrictions."
(where **guid** is an actual GUID)
This issue may be linked to my upgrade from vol 2.5 to vol 2.7, but I'm not positive as other changes were made. In the attached app, both "Client" and "Matter" are impacted.
Steps to Reproduce:
Run the attached project.
Open the "Administrator" Role detail view. -> The Permissions list view does not contain types for many-to-many associations.
Try to create and save a Matter object. -> A security exception is raised.
Refresh the "Administrator" Role detail view. -> The Permissions list view now contains DevExpress.ExpressApp.DC.GeneratedClasses group with intermediate entities, but access to them is denied.

Comments (2)
DevExpress Support Team 13 years ago

    Hi Will,
    Thank you for the report. This issue is caused by a bug in our framework. We will fix it as soon as we can.
    Thanks,
    Michael.

    DevExpress Support Team 13 years ago

      Hi Will,
      We have investigated this issue and found out that it is caused by an absence of DC shared parts support in the new security system (see issue Security.DC - The IsGranted method always returns 'false' for entities that were registered with the help of the XafTypesInfo.Instance.RegisterSharedPart method). We cannot fix it immediately as it requires implementing additional improvements in the new security system. We will do our best to address this scenario as soon as we can.
      Thanks,
      Michael.

      Answers approved by DevExpress Support

      created 13 years ago (modified 13 years ago)

      I have already posted a solution for this at:
      http://community.devexpress.com/forums/t/107287.aspx#362351

      I have modified a little bit to take care of secured non persistent types.

      Here is the code (same as the attached file)

      Visual Basic
      Imports DevExpress.ExpressApp.Security Imports DevExpress.ExpressApp.DC Imports DevExpress.ExpressApp Namespace Security Public Class SecurityStrategyComplexEx Inherits SecurityStrategyComplex Public Sub New() End Sub Public Sub New(ByVal userType As Type, ByVal roleType As Type, ByVal authentication As AuthenticationBase) MyBase.New(userType, roleType, authentication) End Sub Public Overrides Function IsGranted(permissionRequest As IPermissionRequest) As Boolean If TypeOf permissionRequest Is AnyMemberOperationPermissionRequest Then Dim request As AnyMemberOperationPermissionRequest = CType(permissionRequest, AnyMemberOperationPermissionRequest) Dim TypeInfo As ITypeInfo = XafTypesInfo.Instance.FindTypeInfo(request.ObjectType) Dim Found As Boolean = False For Each TI As ITypeInfo In XafTypesInfo.Instance.PersistentTypes If TI.Equals(TypeInfo) Then Found = True Exit For End If Next If Not Found Then If Not SecurityStrategy.SecuredNonPersistentTypes.Contains(TypeInfo.Type) Then Return True End If End If End If Return MyBase.IsGranted(permissionRequest) End Function End Class End Namespace

        Comments (3)
        Dennis Garavsky (DevExpress) 13 years ago

          Santiago,
          Thank you for taking your time to post this temporary solution here. We highly appreciate it.

          PK PK
          Peter Kieslinger 11 years ago

            Hi Dennis,
            I ran into the same problem with 14.1.
            Only administrators can save objects which are derived from IPersistentResource.
            The solution above does not solve it in my case, because the IsGranted method never hits the generated types of the inherited interfaces.
            Regards,
            Peter

            Dennis Garavsky (DevExpress) 11 years ago

              @Peter: Let's continue discussing your case in the separate thread you created: T142027. I would also kindly ask you to update it with your sample project, so we can see the problem in action and debug it. If you can replicate this behavior with a DC-version of our SecurityDemo, please also provide us with it and required repro steps.

              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.