001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.permission;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020    import com.liferay.portal.model.Group;
021    import com.liferay.portal.security.permission.PermissionChecker;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class GroupPermissionUtil {
027    
028            public static void check(
029                            PermissionChecker permissionChecker, Group group, String actionId)
030                    throws PortalException, SystemException {
031    
032                    getGroupPermission().check(permissionChecker, group, actionId);
033            }
034    
035            public static void check(
036                            PermissionChecker permissionChecker, long groupId, String actionId)
037                    throws PortalException, SystemException {
038    
039                    getGroupPermission().check(permissionChecker, groupId, actionId);
040            }
041    
042            public static boolean contains(
043                            PermissionChecker permissionChecker, Group group, String actionId)
044                    throws PortalException, SystemException {
045    
046                    return getGroupPermission().contains(
047                            permissionChecker, group, actionId);
048            }
049    
050            public static boolean contains(
051                            PermissionChecker permissionChecker, long groupId, String actionId)
052                    throws PortalException, SystemException {
053    
054                    return getGroupPermission().contains(
055                            permissionChecker, groupId, actionId);
056            }
057    
058            public static GroupPermission getGroupPermission() {
059                    PortalRuntimePermission.checkGetBeanProperty(GroupPermissionUtil.class);
060    
061                    return _groupPermission;
062            }
063    
064            public void setGroupPermission(GroupPermission groupPermission) {
065                    PortalRuntimePermission.checkSetBeanProperty(getClass());
066    
067                    _groupPermission = groupPermission;
068            }
069    
070            private static GroupPermission _groupPermission;
071    
072    }