Question

I have a requirement to check if logged in user has User Level Create privilege on particular entity specified in Security Role.

I have tried the javascript as well that retrieves the Privilege entity and that checks for privilege but not working as per the expectation.

The javascript retrieves the roles of the user and privilege but it shows canbedeep, canbelocal, canbeglobal to true even if user role have only user level create privilege.

'<fetch mapping="logical" >',
'<entity name="role">',
    '<attribute name="name" />',
    '<link-entity name="systemuserroles" from="roleid" to="roleid">',
        '<link-entity name="systemuser" from="systemuserid" to="systemuserid">',
            '<filter>',
                '<condition attribute="systemuserid" operator="eq-userid"/>',
            '</filter>',
       ' </link-entity>',
    '</link-entity>',
   ' <link-entity name="roleprivileges" from="roleid" to="roleid">',
       ' <link-entity name="privilege" from="privilegeid" to="privilegeid">',
           ' <attribute name="canbebasic" />',
            ' <attribute name="canbedeep" />',
             ' <attribute name="canbelocal" />',
              ' <attribute name="canbeglobal" />',
             '  <attribute name="accessright" />',
              '<filter type="and">',
       '<condition attribute="name" operator="eq" value="prvcreate' + entity + '" />',
       '</filter>',
            '  </link-entity>',
         ' </link-entity>',
      '</entity>',
 ' </fetch>'

Would somebody please help?

Was it helpful?

Solution

I think you are misinterpreting what canbebasic, canbedeep, canbelocal, and canbeglobal mean. These are attributes of the privilege itself (prvCreateAccount, for example). They only indicate that a privilege may be assigned at the user level. They don't indicate that it is assigned at the user level for any particular role or user.

It sounds like you want to check the Privilege Depth Mask on the RolePrivileges entity. Reference this post for a list of the values.

http://sliong.wordpress.com/2012/11/20/crm-2011-privilegedepthmask-and-accessright/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top