cancel
Showing results for 
Search instead for 
Did you mean: 

Getting all permissions from a starting node

LoicNicolet
Champ in-the-making
Champ in-the-making

EN : Hello ! I would like to output a list (.json) with the permissions (inherited or added on the node) of each node, from a starting node. Thank you in advance !

FR : Bonjour !  J'aimerais pouvoir sortir une liste sous forme de .json avec les permissions (héritées ou ajoutées sur le noeud) de chaque noeud, depuis un noeud de base. Merci d'avance !

3 REPLIES 3

EddieMay
World-Class Innovator
World-Class Innovator

Hi @LoicNicolet & welcome to Alfresco!

Passing the nodeId to the getNode API will return JSON information about the node, including its permissions. 

},
    "permissions": {
      "isInheritanceEnabled": true,
      "inherited": [
        {
          "authorityId": "string",
          "name": "string",
          "accessStatus": "ALLOWED"
        }
      ],
      "locallySet": [
        {
          "authorityId": "string",
          "name": "string",
          "accessStatus": "ALLOWED"
        }
      ],
      "settable": [
        "string"
      ]
    }

Gavin Cornwell's API tutorial series is the place to start.

HTH,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

LoicNicolet
Champ in-the-making
Champ in-the-making

Thanks for the reply, but that's not really what i would like to do.

I want to make a script that iterates through all the children, from a starting node, and take out the permissions from every child.

Thank's in advance !

jpotts
World-Class Innovator
World-Class Innovator

You can either use the REST API, which Eddie suggested, and that will give you the permissions for a node. You can then continue to traverse the tree using the REST API grabbing the permissions from each node as you go.

The downside of this approach is that you'll make many HTTP requests for a tree of significant size.

Alternatively, you can write a web script. If you use JavaScript for your web script controller, the ScriptNode object has a getChildren method and a directPermissions property. Using those in combination you can recursively traverse the tree at any starting point using directPermissions to get the perms and using getChildren to get a list of each folder's children.

The downside of this approach is that your web script might timeout or run out of memory if the tree is extremely large.

Either way works.