001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet;
016    
017    import com.liferay.portal.model.Group;
018    import com.liferay.portal.model.Portlet;
019    import com.liferay.portal.security.permission.PermissionChecker;
020    
021    /**
022     * Represents the administrator control panel entry for portlets that shall only
023     * be visible and accessible to the company's administrator. In a portlet's
024     * <code>liferay-portlet.xml</code> file, this class can be specified as the
025     * value for the
026     * <a href="http://docs.liferay.com/portal/6.2/definitions/liferay-portlet-app_6_2_0.dtd.html#control-panel-entry-class" >
027     * control-panel-entry-class
028     * </a>
029     * element.
030     *
031     * @author Brian Wing Shun Chan
032     */
033    public class AdministratorControlPanelEntry extends BaseControlPanelEntry {
034    
035            /**
036             * Returns <code>true</code> if the current user is the company's
037             * administrator.
038             *
039             * @param  permissionChecker the permission checker referencing the current
040             *         user
041             * @param  group the group
042             * @param  portlet the portlet being checked
043             * @return <code>true</code> if the current user is the company's
044             *         administrator
045             * @throws Exception if an exception occurred
046             */
047            @Override
048            public boolean hasAccessPermission(
049                            PermissionChecker permissionChecker, Group group, Portlet portlet)
050                    throws Exception {
051    
052                    return permissionChecker.isCompanyAdmin();
053            }
054    
055    }