Laliwala IT Services

Laliwala IT Services
Website Development

Monday, February 21, 2011

liferay Hide Portlet, Portlet Configuration, liferay functionality, portlet config, responsability, example, web content

Sandeep Nair : Hi,





Right now in Liferay we can show or hide portlets based on roles and permission. But sometimes it becomes necessary to hide a portlet on particular page and wish we had some configuration.








Like when user is not logged in we show sign in portlet and some static web content. Then once he is logged in we would want to hide that portlet for that page and some other portlet is displayed in its place which can be configured by admin or one with apt roles. Right now how we manage to do it is like redirecting the user to some other page where those portlets are there.











What do you think about it?





Regards,

Sandeep



Mazhar Anwar : Hi Sandeep,








If it is the case of Sign In portlet only, you can remove the line "Your are logged in as .... User" from jsp and I think there will not be any content in the portlet and you can achieve what you want. But make sure Show Borders of the portlet is disabled.






Sandeep Nair : Thanks Mazhar,








I was talking in general about having such a functionality where in someone with a Role can do this as a portlet config option based on some rule.






Jorge Ferrer : I think in the use case you've mentioned it's the responsability of the portlet itself to decide under which circumstances it may hide itself.








For an example of this, look at the Web Content Display portlet (journal_content). When there is no content selected yet it's invisible except for the administrator.

2 comments:

  1. I want to show portlets to only site-owner and not normal user. I dont want to use portal-ext properties. can you provide me an alternative.


    Thanks. Jay :)

    ReplyDelete
  2. whoah this weblog is excellent i love reading your posts.

    Keep up the good work! You recognize, many persons are hunting around for this
    information, you can aid them greatly.

    Here is my web blog ... Registry cleaner software

    ReplyDelete