cancel
Showing results for 
Search instead for 
Did you mean: 

Knowing if a permission is inherit

palba
Champ in-the-making
Champ in-the-making
Hi.

I get the permissions of a folder with:

folder.permissions

and I get the string:

"ALLOWED;test1;Collaborator,ALLOWED;test2;Collaborator,ALLOWED;GROUP_EVERYONE;Consumer"

Is there any way to tell if the "Collaborator" rol of the user "test1" is a permission directly applied to the node, or if it is inherit from the parent folder?

Thank you in advance
3 REPLIES 3

abarisone
Star Contributor
Star Contributor
Hi all,
I have the same problem with Alfresco 3.3g.
How to tell if a node permission comes from inheritance?
Any help is appreciated!!!

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

If you go to the JSF client and look at the Node Browser it will tell you if permissions are directly assigned or inherited.
The results from some PermissionService methods include inheritance information.

Andy

abarisone
Star Contributor
Star Contributor
Thanks for your reply.
I think the method we are looking for is
getAllSetPermissions(NodeRef) : Set<AccessPermission>

In fact it returns a Set of AccessPermission and for each of them we can (hopefully) check these properties:

/**
     * At what position in the inheritance chain for permissions is this permission set?
     * = 0 -> Set direct on the object.
     * > 0 -> Inherited
     * < 0 -> We don't know and are using this object for reporting (e.g. the actual permissions that apply to a node for the current user)
     * @return
     */
    public int getPosition();
   
   /**
    * Is this an inherited permission entry?
    * @return
    */
    public boolean isInherited();
   
    /**
     * Is this permission set on the object?
     * @return
     */
     public boolean isSetDirectly();

Moreover I think we must go for a Java backed webscript, because I don't think that the permission object available in javascript has these methods exposed.
Am I right?