Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Hide portlet from guest users

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.34k
    Comment on it

    Hello programmers,

    This blog gonna help you to hide a portlet from the guest users. It's very easy. To hide a portlet for any role, a very simple method is to remove the view permission from the portlet configuration.

    Now if you check the page as a guest user or the role you removed the permission, it will be showing some error.

    You do not have the roles required to access this portlet.

    Usually it doesn't look good and sensible appearing error on the page. If you want to remove that error from your page, there are two methods - 

    1) Override by hook or reset to false the following property -

    Please notice, this property would be applied globally. The error message will be hidden from everywhere. If that's your requirement, you may move forward with this only.

    2) Configure in portlet.xml - 


    Set false to the show-portlet-access-denied in portlet configuration. Please notice, in liferay-portlet.xml order of properties matters under portlet tag. It must look like - 


    That will be applied only to this portlet only. 

    That are the ways, you can hide the whole portlet from public/guest users from your pages.


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: