marklogicmarklogic-10

Get all roles from security database in Marklgoic


I am trying the get roles from security database but i am not able to get all roles, it seems that Compartment role i am not getting, below is the query i am trying.

for  $ids in xdmp:get-current-roles()
let $Rolename := xdmp:role-name($ids)
return $Rolename

Can anyone suggest how can I achieve this, I want to get all the roles within security database


Solution

  • xdmp:get-current-roles() will only return the roles assigned and inherited by the current user.

    In order to list all roles in the Security DB, use xdmp:roles()

    for  $ids in xdmp:roles()
    let $Rolename := xdmp:role-name($ids)
    return $Rolename