Powered by Zoomin Software. For more details please contactZoomin

Secure MarkLogic Server

Create Roles

  • Last Updated: April 14, 2026
  • 1 minute read
    • MarkLogic Server
    • Version 10.0
    • Documentation

Sammy sets up some roles, region-APAC, region-EMEA, and region-NA, by running this code against the Security database:

xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at   "/MarkLogic/security.xqy";

sec:create-role("can-read", "General read", (), (), ()),
sec:create-role("region-APAC", "Can see APAC documents.",
   (), (), (), (), (), 
   map:map()=>map:with(
     "read", cts:element-query(xs:QName("metadata"), cts:element-word-query(xs:QName("region"), "APAC")))
),
sec:create-role("region-EMEA", "Can see EMEA documents.", 
   (  ), (), (), (), (), 
   map:map()=>map:with(
     "read", cts:element-query(xs:QName("metadata"), cts:element-word-query(xs:QName("region"), "EMEA")))
),
sec:create-role("region-NA", "Can see NA documents.",
   (), (), (), (), (), 
   map:map()=>map:with(
     "read", cts:element-query(xs:QName("metadata"), cts:element-word-query(xs:QName("region"), "NA")))
)
TitleResults for “How to create a CRG?”Also Available inAlert