Skip to main content

Securing MarkLogic Server

Insert the Documents and Add Permissions

For simplicity, we will reuse the 6 documents in Scenario 1: Region Restrictions. Here are the new permissions that need to be added:

xquery version "1.0-ml";
(: Doc 1 to 4 have compartment compartment-group. Doc 5 and 6 don't :)

let $permissions := (xdmp:permission("can-read","read"), 
                     xdmp:permission("can-update","node-update"),
                     xdmp:permission("group-all","read"))
for $i in 1 to 4
return xdmp:document-add-permissions("/doc"||$i||".xml", $permissions),

xdmp:document-add-permissions("/doc5.xml", 
                     (xdmp:permission("can-read","read"),
                     xdmp:permission("can-update","node-update"))),

xdmp:document-add-permissions("/doc6.xml", 
                     (xdmp:permission("can-read","read"), 
                     xdmp:permission("can-update","node-update")))