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