Forum Discussion
Payal
6 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!
Related Content
- 7 months ago
- 12 months ago
- 2 years ago