Setting Permissions Explicitly
Assume that the following code snippet is executed as user Ron
of the engineering
role. The code inserts a document with the following permissions:
read
andinsert
permissions for theengineering
roleupdate
,node-update
, andread
permissions for theengineering-manager
role
... xdmp:document-insert("/widget.com/engineering/features/2017-q1.xml", <new-features> <feature> <name>blue whistle</name> <assigned-to>Ron</assigned-to> ... </feature> ... </new-features>, (xdmp:permission("engineering", "read"), xdmp:permission("engineering", "insert"), xdmp:permission("engineering-manager", "read"), xdmp:permission("engineering-manager", "update"), xdmp:permission("engineering-manager", "node-update")) ...
If you specify permissions to the function call explicitly, as shown above, those permissions override any default permission settings associated with the user (through user settings and role inheritance).