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 <a
026     * href="http://docs.liferay.com/portal/7.0/definitions/liferay-portlet-app_7_0_0.dtd.html#control-panel-entry-class"
027     * > control-panel-entry-class </a> element.
028     *
029     * @author Brian Wing Shun Chan
030     */
031    public class AdministratorControlPanelEntry extends BaseControlPanelEntry {
032    
033            /**
034             * Returns <code>true</code> if the current user is the company's
035             * administrator.
036             *
037             * @param  permissionChecker the permission checker referencing the current
038             *         user
039             * @param  group the group
040             * @param  portlet the portlet being checked
041             * @return <code>true</code> if the current user is the company's
042             *         administrator
043             * @throws Exception if an exception occurred
044             */
045            @Override
046            public boolean hasAccessPermission(
047                            PermissionChecker permissionChecker, Group group, Portlet portlet)
048                    throws Exception {
049    
050                    return permissionChecker.isCompanyAdmin();
051            }
052    
053    }