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