cancel
Showing results for 
Search instead for 
Did you mean: 

PermissionService getAllSetPermissions()

steel
Champ in-the-making
Champ in-the-making
Currently getAllSetPermissions() doesn't grab the permissions that it inherits if the node is suppose to inherit parent permissions. I am writing my own recursive methods to grab all the inherited permissions. Shouldn't this be taken care of in this function? or its own function in the permission service?

thanks.
8 REPLIES 8

andy
Champ on-the-rise
Champ on-the-rise
Hi

This API call is there to find out what is actully set on a node.

Why do you need the function you describe?
What are you trying to do?

I can understand wanting to know what is set by inheritance (and not specifically on the node). Is this what is missing?

The getPermissons(NodeRef) finds all available permissions and returns how they are set for the current user. This could easily be changed to accept any authority.

Regards

Andy

steel
Champ in-the-making
Champ in-the-making
In my case I have a document that is in a folder several folders deep each set to inherit permissions from its parent.  The document is also set to inherit its permissions.  I am checking for the authorities allowed to access this document so I have written code to recursively check for inherited authorities allowed on this document.

What i have works and is fine, I'm just curious if such a function should be in the permissionService.

andy
Champ on-the-rise
Champ on-the-rise
Hi

I think in general it would be useful.

Remember the PermissionService will only tell you what authorities are set to have access. You will have to expand groups to get the full list of authorities that have access.

Regards

Andy

steel
Champ in-the-making
Champ in-the-making
Hi

I think in general it would be useful.

Remember the PermissionService will only tell you what authorities are set to have access. You will have to expand groups to get the full list of authorities that have access.

Regards

Andy

Yep.

jjf
Champ in-the-making
Champ in-the-making
Was this ever implemented?  I'm trying to obtain a list of all permissions (including inherited) for a given node but can't find a method to do it.

andy
Champ on-the-rise
Champ on-the-rise
Hi

No, this has not yet been added. It was no where near the top of the list for 2.1.  However, there is code upon which this could be based in the tests.

Andy

jjf
Champ in-the-making
Champ in-the-making
Thanks.  Is there a specific test which contains this code?

I'll start looking through the test classes to find it.

jjf
Champ in-the-making
Champ in-the-making
Nevermind.  This should do it…

private Collection<AccessPermission> getAllPermissions(NodeRef node){
        //get permissions for this node
        Collection<AccessPermission> perms = permissionService.getAllSetPermissions(node);
       
        //if it inherits, get the permissions of the parent
        if( permissionService.getInheritParentPermissions(node) ){
            List<ChildAssociationRef> parents = nodeService.getParentAssocs(node);
            if(parents.size()>0){
                NodeRef parent = (parents.get(0)).getParentRef();
                perms.addAll((getAllPermissions(parent)));
            }
        }
        return perms;
    }