The has-control-menu class is shown for non-administrator users
Written By
Daniel Mijarra
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
- I want to use the
has-control-menu class (included in the body tag) to check if the user is an administrator or not and to be able to apply certain CSS rules in my Theme.
Resolution
- The presence of the
has-control-menu class in the body does not mean that the user is an administrator, since there are situations in which the control menu is used even if the user does not have initial or explicit access to the control panel.
- For example, if we grant a user permission to add a blog entry, they will be redirected to the control panel when they add a blog entry. Therefore, the control menu bar will now have two additional buttons: a "back arrow" button and the user or personal menu icon (this icon shifts up from the page to the control menu bar).
- We do not recommend delegating this check to a CSS class, it is recommended to use the appropriate APIs to know if the user is an Administrator or not.
Did this article resolve your issue ?