02-22-2021 09:59 AM
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 !
02-22-2021 11:30 AM
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,
02-23-2021 01:17 AM
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 !
02-23-2021 03:37 PM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.