Skip to main content

Securing MarkLogic Server

Insert the Documents and Add Permissions

Using Query Console, insert the following documents to the database. /doc5.xml and /doc6.xml are added with read permissions for can-read, so that they are visible to anyone that has can-read role.

xquery version "1.0-ml";
xdmp:document-insert("/doc1.xml",
   <root>
     <metadata>
     <region>region-NA</region>
     <group>group-engineering</group>
     </metadata>
     <email>jane@companyabc.com</email>
     <feature>New feature</feature>
   </root>),
xdmp:document-insert("/doc2.xml",
   <root>
     <metadata>
       <region>region-NA</region>
       <group>group-finance</group>
     </metadata>
     <email>matt@companyabc.com</email>
     <price>100</price>
   </root>),
xdmp:document-insert("/doc3.xml",
   <root>
     <metadata>
       <region>region-EMEA</region>
       <group>group-engineering</group>
     </metadata>
     <email>jim@companyabc.com</email>
<feature>Another new feature</feature>
   </root>),
xdmp:document-insert("/doc4.xml",
   <root>
     <metadata>
       <region>region-APAC</region>
       <group>group-finance</group>
     </metadata>
     <email>jeff@companyabc.com</email>
     <price>10</price>
   </root>),
xdmp:document-insert("/doc5.xml",
   <root>
     <metadata>
       <region>region-all</region>
       <group>group-all</group>
     </metadata>
     <email>dummy@companyabc.com</email>
   </root>),
xdmp:document-insert("/doc6.xml",
   <root>
     <metadata>
      <region>region-all</region>
      <group>group-finance</group>
     </metadata>
     <email>dummy@companyabc.com</email>
   </root>),
xdmp:document-add-permissions("/doc5.xml", xdmp:permission("can-read","read")),
xdmp:document-add-permissions("/doc6.xml", xdmp:permission("can-read","read"))