構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Dave Weitzel
How do you hide control panel themes from users?
2011/08/18 7:09
答え

Dave Weitzel

ランク: Regular Member

投稿: 203

参加年月日: 2009/11/18

最近の投稿

We have a new control panel theme and have it deployed as such through the portal>settings> dialogue and in a property for start up.

BUT the theme still shows up in the available themes for regular pages, I cannot see how this is done for the standard Liferay control panel theme.

Can anyone point me to the right setting?
Pasi Kössi
RE: How do you hide control panel themes from users?
2011/08/19 2:47
答え

Pasi Kössi

ランク: New Member

投稿: 1

参加年月日: 2011/05/03

最近の投稿

The functionality to hide the standard Control Panel theme seems to be hard coded in Java inside the ThemeService. You could do the same
for your own custom theme by hooking the service, or just hooking the jsp that shows the themes (/html/portlet/communities/edit_pages_look_and_feel.jsp).

PK
William Gosse
RE: How do you hide control panel themes from users?
2011/09/20 4:48
答え

William Gosse

ランク: Expert

投稿: 251

参加年月日: 2010/07/04

最近の投稿

I was able to disable the viewing of the control panel by certain users by writing an extension to the ServicePreAction:
 1
 2package com.salesquest.portal.events;
 3
 4import com.liferay.portal.events.ServicePreAction;
 5import com.liferay.portal.kernel.exception.PortalException;
 6import com.liferay.portal.kernel.exception.SystemException;
 7import com.liferay.portal.model.Group;
 8import com.liferay.portal.model.User;
 9import com.liferay.portal.security.permission.PermissionChecker;
10import com.liferay.portal.service.GroupLocalServiceUtil;
11import com.salesquest.portal.utils.SQPortalUtils;
12
13public class SQServicePreAction extends ServicePreAction {
14
15    @Override
16    protected boolean isViewableGroup(User user, long groupId,
17            boolean privateLayout, long layoutId,
18            PermissionChecker permissionChecker) throws PortalException,
19            SystemException {
20        boolean isViewable = super.isViewableGroup(user, groupId,
21                privateLayout, layoutId, permissionChecker);
22
23        if (isViewable) {
24            Group group = GroupLocalServiceUtil.getGroup(groupId);
25            
26            if (group.isControlPanel())
27            {
28                long companyId = group.getCompanyId();
29                long userId = user.getUserId();
30
31                if (SQPortalUtils.isUserAdminUser(companyId, userId))
32                    isViewable = true;
33                else
34                    isViewable = !SQPortalUtils.isUserEnterpriseUser(userId);
35            }
36        }
37
38        return isViewable;
39    }
40}
Paul Butenko
RE: How do you hide control panel themes from users?
2012/07/13 0:06
答え

Paul Butenko

ランク: Junior Member

投稿: 38

参加年月日: 2010/07/01

最近の投稿

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