Create the Documents and Add Permissions
Using the MarkLogic Server Query Console, add a document for each combination of permissions in the following table:
Document |
Permissions (Role, Capability) |
Users with Access |
---|---|---|
|
( ( ( ( ( ( ( ( |
Don |
|
( ( ( ( |
Don and Ellen |
|
( ( |
All users |
|
( ( ( ( ( |
Frank, Don, Ellen |
|
( ( ( ( |
Ellen, Hannah |
You can use XQuery code similar to the following example to insert the sample documents into a database of your choice. This code adds a document with a URI of
doc1.xml
, containing one<a>
element and a set of five permissions.xquery version "1.0-ml"; declare namespace html = "http://www.w3.org/1999/xhtml"; xdmp:document-insert( "/doc1.xml", <a>This is document 1.</a>, (xdmp:permission("can-read", "read"), xdmp:permission("can-read", "update"), xdmp:permission("US", "read"), xdmp:permission("US", "update"), xdmp:permission("Executive", "read"), xdmp:permission("Executive", "update"), xdmp:permission("top-secret", "read"), xdmp:permission("top-secret", "update")))
The
doc1.xml
document can only be read byDon
because the permissions designate all three compartments andDon
is the only user with a role in all three of the necessary compartmented rolesExecutive
,US
, andtop-secret
, plus the basiccan-read
role.Create the rest of the sample documents changing the sample code as needed. You need to change the document URI and the text to correspond to
doc2.xml
,doc3.xml
,doc4.xml
, anddoc5.xml
and modify the permissions for each document as suggested in the table in Create the Documents and Add Permissions.