Forum Discussion

Inactive User's avatar
Inactive User
6 years ago

How to determine a user's role? In LiQL or Context Objects or both

Finding the documentation on <roles> to be a bit confusing. I want to know if a user is a certain role, for example, "Employee" or role.id = 23. Unsure how to make that work since the LiQL only gives constraints of granting_id ... and no documentation about what that is other than it's the id that grants the role. Confusing. 


https😕/community.khoros.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=roles

 

Thanks

  • Inactive User - Please try below-mentioned API:

    To get all the users within a particular role:

     

     <#assign userRoles = rest("/roles/name/Administrator/users").users.user />

     

     

    To get roles for a specific user:

     

     <#assign userRoles = rest("/users/id/12/roles").roles.role />

     

     

    Please let me know if you need anything else.

     

    Thanks!