Loading TOC...

xdmp:role

xdmp:role(
   $role as xs:string
) as xs:unsignedLong

Summary

Returns the role ID for the specified role name. Unlike the security library module function sec:uid-for-name, this function can be evaluated against any database and does not need to be evaluated directly against the security database. It returns the role ID from the security database configured for the database in which the App Server evaluates against.

Parameters
$role A role name.

Example

xdmp:role("editor")
=> 2392349873545

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • The documentation states that this function returns an xs:integer. While it may be true that any value returned from the function could be cast as an xs:integer I'm quite sure that it will never be a negative number. Similar functions (eg: xdmp:server) return an xs:unsignedLong, wondering if that's actually the case here as well.
  • It should be noted that if the role does not exist this function will throw an exception.