I want to restrict some users to view the control menu based on the inherited site roles. I tried with userGroupRoleLocalService to fetch user and it is displaying the default roles and not from the inherited roles.
Could someone help me with how to fetch the inherited site roles in FTL?
Its is not a good practise to perform permission checks based on the existence of certain Roles. Rather use a permissionChecker
- afaik there is a "VIEW_CONTROL_PANEL"
(for ResourceName "90" i.e. Portal) permission to check. Assign this permission to the roles you want to grant access to control panel. In your freemarker theme use:
<#if permissionChecker.hasPermission(scopeGroupId, "90", 0, "VIEW_CONTROL_PANEL")>
<@liferay.control_menu />
</#if>