cancel
Showing results for 
Search instead for 
Did you mean: 

How to get authorities set certain permission

jamen
Confirmed Champ
Confirmed Champ
Hi,

I'm currently looking at indexing out entitlements information to an external index.  Looking at the permission service I do not see a way of easily access the FULL set of inherited and explicitly set permissions on a node.

I'm working with Alfresco 3.3.1E right now, future versions we will evaluate shortly are 4.0.2E.  All I see on the later version is
public NodePermissionEntry getSetPermissions(NodeRef nodeRef)
in the PermissionServiceSPI.

Is there a way that I can fetch the full set of entitlements for the node from an API or existing method (that may be hidden)?  Alternatively is there a way I can see which authorities have READ rights on a node.

Thanks
Jamen
2 REPLIES 2

abarisone
Star Contributor
Star Contributor
Hi,
you can use 
Set<AccessPermission> org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions(NodeRef arg0)
@Auditable(parameters={"nodeRef"})
which gives you all set permission on a node.
Then iterating on the set
for(AccessPermission permission : permissionList) {
   String authority = permission.getAuthority();
   String role = permission.getPermission();
   AccessStatus access = permission.getAccessStatus();
   if (permission.isInherited())
        System.out.println(access.toString() + ";" + authority + ";" + role + ");
   else
       …
}
you can get all information you need.

Regards,
Andrea

jamen
Confirmed Champ
Confirmed Champ
Thanks Andrea!

Actually shouldn't have missed that.  Thought that PermissionServiceSPI was new in 4.0.2 and that it replaced the interface you saw.  Whoops Smiley Happy