Legacy Knowledge Base
Published Jul. 2, 2025

How to hide the Product Menu for non-admin users?

Written By

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • In Liferay DXP 7.0 and 7.1, there may be the requirement to hide the Product Menu (along with the icon to open it) to certain roles (for example, regular/non-admin, site users):

DXP_Product_Menu.png

Environment

  • Liferay 7.0 DXP
  • Liferay 7.1 DXP

Resolution

  • Liferay DXP does not provide a way to achieve the requirement out of the box.
  • It is possible to achieve the desired behavior with customization. There are two main ways of approaching this requirement, both connected.

1. Custom theme

In the portal_normal.ftl of a custom theme, surround the <@liferay.control_menu /> tag with a permission check, something like:

<#if is_signed_in>
    <#assign roles = user.getRoles() 
           showcontrolmenu = false
    />
    <#list roles as role>
         <#if role.getName() == "Administrator" || role.getName() == "Other Role" >
                   <#assign showcontrolmenu = true />
                   <#break>
         </#if>             
    </#list> 
    <#if showcontrolmenu>
        <@liferay.control_menu />
    </#if>
</#if>

As an alternative to this, the necessary code may also be constructed in the theme's init.ftl:

permission_checker = themeDisplay.getPermissionChecker() 
is_group_admin = permission_checker.isGroupAdmin(group_id)
is_omniadmin = permission_checker.isOmniadmin()
show_dockbar = is_group_admin || is_omniadmin

and then used:

<#if show_dockbar> 
<@liferay_ui["quick-access"] contentId="#main-content" />
<@liferay_util["include"] page=body_top_include />
<@liferay.control_menu />
</#if>

in the portal_normal.ftl. In addition to this, the Product Menu margin might require adjustment after the change. In main.css, something like:

@media only screen and (min-width:768px){
body.open #wrapper{
padding-left:0px;
}
}

could help to resolve the visual gap.

2. Control Menu Entry / Theme Contributors / Template Context Contributor

For this approach, here is a list of the related tutorials:

Added to the above, also some community resources:

Please note: In both cases, (at least) the option to Sign Out (/c/portal/logout):

DXP_Product_Menu_Sign_Out.png

shall be moved elsewhere through your portal's theme, else, with the Product Menu disabled, it will be unreachable.

Additional Information

  • The Product Menu has been dis-joined from regular user roles in the latest release, therefore this will no longer be an issue as of Liferay DXP 7.2+
  • The resources provided are purely a hint to help the custom development, the implementation will be up to each developer's discretion.
Did this article resolve your issue ?

Legacy Knowledge Base