Forum Discussion
7 Replies
- Payal6 years agoDirector
Abhilasha - You can create a custom component which will only be access by admins by adding the following code:
<#assign isAdmin = false /> <#list restadmin("/users/id/${user.id?c}/roles").roles.role as mainrole> <#if mainrole.name?? && (mainrole.name == "Administrator")> <#assign isAdmin = true /> <#break> </#if> </#list> <#if isAdmin> .....................YOUR CODE HERE...................... </#if>
To add the roles to users, you need to use API in your code:
Please let me know if this helps.
Thanks!
- browneandrae6 years agoExpert
From the looks of it , you can't here is what you can do to different update a user and also different entities, https://community.khoros.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=users#action-update
- browneandrae6 years agoExpertInteresting, thanks for the reference, first time seeing it.
- luk6 years agoBoss
browneandrae adding/removing role is unfortunately not possible with API v2 but definitely with v1 as Payal wrote above!
- browneandrae6 years agoExpert
luk nice where are the docs for api v1 ?
- luk6 years agoBoss
browneandrae what you're looking for is here for adding a role, note that it also works with /roles/name/<rolename>/users/add?role.user=/users/login/<userlogin> it's just not documented (ping SuzieH, any possibility to add this?)
- SuzieH6 years agoKhoros Alumni (Retired)
Thanks, luk. I should be able to get this into our docs in the next few days.
Related Content
- 9 months ago
- 2 years ago
- 2 years ago
- 2 years ago