Steps for Example Setup
To set up this example scenario, perform the following steps, using the Admin Interface:
Create a role named
ReadsStuff
.Create a user named
ReadOnly
and grant this user theReadsStuff
role.Create a role named
WritesStuff
and grant this role theReadsStuff
role.Grant the
WritesStuff
role theany-uri
privilege, as well as any execute privileges needed for your application code.Create a user named
LoadsStuff
and grant this user theWritesStuff
role. When you load documents, load them as theLoadsStuff
user and give each document an update and insert permission for theWritesStuff
role and a read permission for theReadsStuff
role.
Here is sample code to create a set of permissions with xdmp:permission()
:
(xdmp:permission("ReadsStuff", "read"), xdmp:permission("WritesStuff", "insert"), xdmp:permission("WritesStuff", "update"))
You can also create a set of permissions with the permissions
option of either xdmp:document-insert()
or xdmp:document-load()
.
Also, instead of specifying the permissions when you load documents, you can assign default permissions to the LoadsStuff
user or the WritesStuff
role.