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.portal.service.permission;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019    import com.liferay.portal.model.Team;
020    import com.liferay.portal.security.permission.PermissionChecker;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Raymond Aug??
025     */
026    public class TeamPermissionUtil {
027    
028            public static void check(
029                            PermissionChecker permissionChecker, long teamId, String actionId)
030                    throws PortalException {
031    
032                    getTeamPermission().check(permissionChecker, teamId, actionId);
033            }
034    
035            public static void check(
036                            PermissionChecker permissionChecker, Team team, String actionId)
037                    throws PortalException {
038    
039                    getTeamPermission().check(permissionChecker, team, actionId);
040            }
041    
042            public static boolean contains(
043                            PermissionChecker permissionChecker, long teamId, String actionId)
044                    throws PortalException {
045    
046                    return getTeamPermission().contains(
047                            permissionChecker, teamId, actionId);
048            }
049    
050            public static boolean contains(
051                            PermissionChecker permissionChecker, Team team, String actionId)
052                    throws PortalException {
053    
054                    return getTeamPermission().contains(permissionChecker, team, actionId);
055            }
056    
057            public static TeamPermission getTeamPermission() {
058                    PortalRuntimePermission.checkGetBeanProperty(TeamPermissionUtil.class);
059    
060                    return _teamPermission;
061            }
062    
063            public void setTeamPermission(TeamPermission teamPermission) {
064                    PortalRuntimePermission.checkSetBeanProperty(getClass());
065    
066                    _teamPermission = teamPermission;
067            }
068    
069            private static TeamPermission _teamPermission;
070    
071    }