xdmp.userRoles( name as String, [extSecId as (Number|String)], [secDbFirst as Boolean] ) as Sequence
Returns all roles assigned to a user, including roles directly assigned to the user and roles inherited by other roles. Returns roles for users from the security database or from the specified external security, depending on the parameter values.
This function is not applicable for external security using SAML authentication because the roles cannot be determined by the username.
xdmp.userRoles("ian"); => [2349872340, 432987324]
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.