Hi,
For liferay 6.1 you can hide liferays dockbar (control panel) by canging into portal_noranl.vm:
#if ($is_signed_in) to #if (($is_signed_in) && $permissionChecker.isCompanyAdmin($company_id))
To totally restrict access for non admin users hook can be used:
add portal.properties with property servlet.service.events.pre=my.event.portal.ControlPanelAccessPreAction
and in class add next method:
1public void run(HttpServletRequest request,
2 HttpServletResponse response) throws ActionException {
3 try {
4
5 ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
6 if (GroupLocalServiceUtil.getGroup(themeDisplay.getLayout().getGroupId()).isControlPanel()) {
7
8 User currentUser = UserServiceUtil.getUserById(themeDisplay.getUserId());
9 if (!RoleServiceUtil.hasUserRole(currentUser.getUserId(),
10 currentUser.getCompanyId(),
11 "administrator",
12 true)) {
13 throw new PrincipalException("User " + request.getRemoteUser()
14 + " can't access the control panel.");
15 }
16
17 }
18 } catch (Exception ex) {
19 throw new ActionException(ex);
20 }
21 }
You can check complete example
here Bitte melden Sie sich an, um diesen Inhalt als unangebracht zu kennzeichnen.