Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Jedi Lord xx
Howto Restrict Access To the ControlPanel in MyCommunity My private page
29 de junio de 2010 3:09
Respuesta

Jedi Lord xx

Ranking: Junior Member

Mensajes: 47

Fecha de incorporación: 2 de septiembre de 2008

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..
Amos Fong
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
29 de junio de 2010 10:09
Respuesta

Amos Fong

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1844

Fecha de incorporación: 7 de octubre de 2008

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
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
1 de julio de 2010 1:12
Respuesta

Jedi Lord xx

Ranking: Junior Member

Mensajes: 47

Fecha de incorporación: 2 de septiembre de 2008

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.
Amos Fong
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
1 de julio de 2010 9:27
Respuesta

Amos Fong

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1844

Fecha de incorporación: 7 de octubre de 2008

Mensajes recientes

Yea, in the theme, modify dock.vm to not show the control panel link.
Jana Volkmer
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
21 de enero de 2011 6:45
Respuesta

Jana Volkmer

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 4 de octubre de 2010

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
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
8 de marzo de 2011 9:14
Respuesta

Marco Flores Rojas

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 11 de febrero de 2011

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
1control.panel.entry.class.default=com.hook.MyDefaultControlPanelEntry


liferay-hook.xml
1
2<hook>
3    <portal-properties>portal.properties</portal-properties>
4</hook>


MyDefaultControlPanelEntry.java
 1public class MyDefaultControlPanelEntry extends BaseControlPanelEntry {
 2       
 3        @Override
 4        public boolean isVisible(Portlet portlet, String category,
 5            ThemeDisplay themeDisplay) throws Exception {
 6            // TODO Auto-generated method stub
 7            //return super.isVisible(portlet, category, themeDisplay);
 8            if (category.equals(PortletCategoryKeys.CONTENT) || category.equals(PortletCategoryKeys.MY))
 9                return false;
10            else
11                return super.isVisible(portlet, category, themeDisplay);
12        }
13
14        @Override
15        public boolean isVisible(PermissionChecker arg0, Portlet arg1)
16                throws Exception {
17            // TODO Auto-generated method stub
18            return false;
19        }
20   
21}
dhaval nagar
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
23 de marzo de 2011 2:07
Respuesta

dhaval nagar

Ranking: New Member

Mensajes: 5

Fecha de incorporación: 5 de diciembre de 2010

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
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
31 de marzo de 2011 9:44
Respuesta

Marco Flores Rojas

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 11 de febrero de 2011

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):

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


There you can change it by using your own logic

Best regards.
Daniel Wilmes
RE: Howto Restrict Access To the ControlPanel in MyCommunity My private pag
26 de agosto de 2011 9:03
Respuesta

Daniel Wilmes

Ranking: Regular Member

Mensajes: 164

Fecha de incorporación: 23 de mayo de 2011

Mensajes recientes

Did anyone try changing this property in the portal-ext.properties file:

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