xdmp:database-node-query-rolesets( $nodes as node()*, [$options as xs:string*] ) as element(sec:query-rolesets)*
Return a sequence of query-rolesets that are required for proper querying of the given database nodes with Element Level Security.
http://marklogic.com/xdmp/privileges/database-node-query-rolesets
"Nodes" is a sequence of database nodes. If an array is passed in, it will be treated as one array node. Use Sequence.from to convert an array of nodes to a sequence of nodes when necessary.
If neither "all" nor "unconfigured" is present, it defaults to "all".
xdmp:database-node-query-rolesets( fn:doc("/example.xml"), ("all"))
xquery version "1.0-ml"; import module namespace sec = "http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; (: run this against the Security database :) let $qry := 'xdmp:database-node-query-rolesets(fn:doc("/example.xml"), ("all"))' let $qry-rolesets := xdmp:eval($qry, (),<options xmlns="xdmp:eval"> <database>{xdmp:database(YOUR_DB_NAME)}</database> </options>) return sec:add-query-rolesets($qry-rolesets) => (: returns the role id(s) associated with the query rolesets :)