Foros de discusión

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

Jedi Lord xx, modificado hace 13 años.

Howto Restrict Access To the ControlPanel in MyCommunity My private page

Junior Member Mensajes: 47 Fecha de incorporación: 2/09/08 Mensajes recientes
Hi,

. I want to build a portal that pre-regitred users has access pages and their private pages predefined. There is no modify rights to any user. They are just user.

Most of the parts discovered and deployed successfully.

But I could not restrcit access to the Control panel to the user.

They can only see my account link when they click "Control Panel" while they are some other pages.

However whet they are their Private Pages that we pre-created They can see :

Control Panel
* My Account
Content

* Web Content
* Document Library
* Image Gallery
* Bookmarks
* Message Boards
* Blogs
* Wiki
* Polls
* Software Catalog
* Tags
* Categories



I want to show them only MY Account link and all others should be not visible to the user. Only Portal Admin should see all control panenl items.


How I can do this ? I coul not make a ROLES that only access to the My Account in control panel. Some times I am getting really confused and leaving liferay

Please Help.

regards.

L..
thumbnail
Amos Fong, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
Hello,

This can be done by overriding the DefaultControlPanelEntry class in ext. If you're using 6.0, you can override BaseControlPanelEntry in a hook instead.

public class MyDefaultControlPanelEntry extends DefaultControlPanelEntry {

public boolean isVisible(
Portlet portlet, String category, ThemeDisplay themeDisplay)
throws Exception {

Group group = themeDisplay.getScopeGroup();

if (category.equals(PortletCategoryKeys.CONTENT) && group.isUser()) {
return false;
}

return super.isVisible();
}
Jedi Lord xx, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

Junior Member Mensajes: 47 Fecha de incorporación: 2/09/08 Mensajes recientes
Hi ,

I solved the problem.

By the way I want to hide Control Panel from users only Admin should see it. Normal users should see a link only to their profile settings directly not in a control panel menu. I want to put a direct link in the dock bar to the profile setting. Any idea for this ?


L.
thumbnail
Amos Fong, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
Yea, in the theme, modify dock.vm to not show the control panel link.
Jana Volkmer, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

New Member Mensajes: 6 Fecha de incorporación: 4/10/10 Mensajes recientes
Amos Fong:
Hello,

This can be done by overriding the DefaultControlPanelEntry class in ext. If you're using 6.0, you can override BaseControlPanelEntry in a hook instead.

[...]


Hello Amos,

could you please give a bit more information about how to override a LR class using hook (when not changing a service / local service). So far I thought, it's just possible to override service classes.

Thanks & greetings,

J.
Marco Flores Rojas, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

New Member Mensajes: 6 Fecha de incorporación: 11/02/11 Mensajes recientes
Hi Amos, I already created a hook overriding BaseControlPanelEntry but nothing happens,

Do I have to reference this new class in liferay-portlet.xml?

This is my configuration in the hook:

portal.properties
control.panel.entry.class.default=com.hook.MyDefaultControlPanelEntry


liferay-hook.xml

<hook>
	<portal-properties>portal.properties</portal-properties>
</hook>


MyDefaultControlPanelEntry.java
public class MyDefaultControlPanelEntry extends BaseControlPanelEntry {
		
		@Override
		public boolean isVisible(Portlet portlet, String category,
			ThemeDisplay themeDisplay) throws Exception {
		    // TODO Auto-generated method stub
		    //return super.isVisible(portlet, category, themeDisplay);
			if (category.equals(PortletCategoryKeys.CONTENT) || category.equals(PortletCategoryKeys.MY))
				return false;
			else
				return super.isVisible(portlet, category, themeDisplay);
		}

		@Override
		public boolean isVisible(PermissionChecker arg0, Portlet arg1)
				throws Exception {
			// TODO Auto-generated method stub
			return false;
		}
	
}
dhaval nagar, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

New Member Mensajes: 5 Fecha de incorporación: 6/12/10 Mensajes recientes
Hi Marco,

Have you resolved the issue as I am facing the same problem.

I have different hooks which are working fine except this Control Panel entry one.

Let me know if you have found the solution.

regards,
Dhaval
Marco Flores Rojas, modificado hace 13 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

New Member Mensajes: 6 Fecha de incorporación: 11/02/11 Mensajes recientes
Hi dhaval,

I couldn't make the hook work but I tried a work around.

You can use a JSP Hook in order to change the behavior directly in this page:

<portal_ROOT>/html/portlet/control_panel_menu/view.jsp

Locate this row(or something similar):

boolean showMyCommunity = user.getGroup().hasPrivateLayouts() || user.getGroup().hasPublicLayouts();


There you can change it by using your own logic

Best regards.
Daniel Wilmes, modificado hace 12 años.

RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag

Regular Member Mensajes: 164 Fecha de incorporación: 23/05/11 Mensajes recientes
Did anyone try changing this property in the portal-ext.properties file:

control.panel.default.entry.class=com.liferay.portlet.DefaultControlPanelEntry