Loading TOC...

MarkLogic Server 11.0 Product Documentation
xdmp.userRoles

xdmp.userRoles(
   name as String,
   [extSecId as (Number|String)],
   [secDbFirst as Boolean]
) as Sequence

Summary

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.

Parameters
name The user name.
extSecId An external security config ID to search. This is needed only to find an external user. The default is the current App Server's external-security setting.
secDbFirst A boolean value to specify whether to check security database before any specified external security. The default is the current App Server's internal-security setting, or true when running on the task server.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-user-roles

Usage Notes

This function is not applicable for external security using SAML authentication because the roles cannot be determined by the username.

See Also

Example

xdmp.userRoles("ian");
=> [2349872340, 432987324]

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