Foren

How to restrict private pages link in dock for certain users or roles

Adam Brown, geändert vor 13 Jahren.

How to restrict private pages link in dock for certain users or roles

Junior Member Beiträge: 25 Beitrittsdatum: 07.02.11 Neueste Beiträge
Hi all,

I'm trying to modify the dock's dropdown menu and only show private pages for certain roles. What is the preferred/cleanest way to go about this?

Thanks!
thumbnail
José Manuel Domínguez Romero, geändert vor 13 Jahren.

RE: How to restrict private pages link in dock for certain users or roles

Regular Member Beiträge: 219 Beitrittsdatum: 03.02.10 Neueste Beiträge
Hello

Which is Liferay's version that you are using, 5x or 6x? In any case you have to obtain the role or roles of the user who is login. Then, test if the user have a proper role. If the case is yes, show the private page.

In Liferay 5x you must edit the dock.vm template; in the Liferay 6x, the dockbar.js (I think... ).

Regards
Adam Brown, geändert vor 13 Jahren.

RE: How to restrict private pages link in dock for certain users or roles

Junior Member Beiträge: 25 Beitrittsdatum: 07.02.11 Neueste Beiträge
Thanks! I'm using Liferay 6, so I'll go check out that javascript file.
thumbnail
José Manuel Domínguez Romero, geändert vor 13 Jahren.

RE: How to restrict private pages link in dock for certain users or roles

Regular Member Beiträge: 219 Beitrittsdatum: 03.02.10 Neueste Beiträge
Ok Adam,

New discovery: in the html\portlet\dockbar\view.jsp is the code for the dockbar.

The id roles will get obtained with:

ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getUser();
long[] roleIds = user.getRoleIds();


Regards.