
xdmp:default-permissions( [$uri as xs:string], [$output-kind as xs:string] ) as element(sec:permission)*|map:map*
Returns the permissions any new document would get if the current user were to insert a document without specifying the default permissions.
(: Fetch permissions as elements (default behavior) :)
xdmp:default-permissions("http://example.com/content/foo.xml")
(: Returns a sequence of elements, such as the following:
:
: (<sec:permission>
: <sec:capability>read</sec:capability>
: <sec:role-id>324978243</sec:role-id>
: </sec:permission>,
: <sec:permission>
: <sec:capability>read</sec:capability>
: <sec:role-id>32493478578243</sec:role-id>
: </sec:permission>,
: <sec:permission>
: <sec:capability>update</sec:capability>
: <sec:role-id>32493478578243</sec:role-id>
: </sec:permission>)
:)
(: Fetch permissions for the current user, as json objects :)
xquery version "1.0-ml";
xdmp:default-permissions((), "objects")
(: Returns output similar to the following (rendered here as JSON):
:
: {"capability":"read", "roleId":"14918370877051183774"}
: {"capability":"update", "roleId":"8487823278258687528"}
:
: The following is the underlying XML, which you can pass where an
: Object or map:map is expected.
:
: <json:object xmlns:json="http://marklogic.com/xdmp/json"
: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
: xmlns:xs="http://www.w3.org/2001/XMLSchema">
: <json:entry key="capability">
: <json:value xsi:type="xs:string">read</json:value>
: </json:entry>
: <json:entry key="roleId">
: <json:value xsi:type="xs:integer">14918370877051183774</json:value>
: </json:entry>
: </json:object>
: <json:object xmlns:json="http://marklogic.com/xdmp/json"
: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
: xmlns:xs="http://www.w3.org/2001/XMLSchema">
: <json:entry key="capability">
: <json:value xsi:type="xs:string">update</json:value>
: </json:entry>
: <json:entry key="roleId">
: <json:value xsi:type="xs:integer">8487823278258687528</json:value>
: </json:entry>
: </json:object>
:)