fxbauer
13 years agoLithium Alumni (Retired)
How do I show custom text based on permissions?
Hello
a customer is asking to show certain text based on a permission granted to a user.
In this case the customer wants to show a link "Private Message" instead of just the envelope icon...
- 13 years ago
We did this exact same thing with the Private Messages icon --> text. However, we create roles to represent certain actions (as I have not seen a way to access permissions programmatically). You could add the specific permissions to those roles, or simply use the roles as a placeholder. For example, we created a Publisher role that we assign to certain users. We can control content using:
<#list restadmin("/users/id/${user.id?c}/roles").roles.role as role> <#if role.name?? && ((role.name == "Administrator") || (role.name == "Publisher"))> <#assign user_has_role = true /> </#if> </#list> ... <#if user_has_role> ... </#if>