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 omni administrator control panel entry for portlets that shall
023     * only be visible and accessible to the omni 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 Jorge Ferrer
030     */
031    public class OmniadminControlPanelEntry extends BaseControlPanelEntry {
032    
033            /**
034             * Returns <code>true</code> if the current user is an omni administrator.
035             *
036             * @param  permissionChecker the permission checker referencing the current
037             *         user
038             * @param  group the group
039             * @param  portlet the portlet being checked
040             * @return <code>true</code> if the current user is an omni administrator;
041             *         <code>false</code> otherwise
042             * @throws Exception if an exception occurred
043             */
044            @Override
045            public boolean hasAccessPermission(
046                            PermissionChecker permissionChecker, Group group, Portlet portlet)
047                    throws Exception {
048    
049                    return permissionChecker.isOmniadmin();
050            }
051    
052    }