001    /**
002     * Copyright (c) 2000-2010 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.model.Layout;
020    import com.liferay.portal.security.permission.PermissionChecker;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class LayoutPermissionUtil {
026    
027            public static void check(
028                            PermissionChecker permissionChecker, long plid, String actionId)
029                    throws PortalException, SystemException {
030    
031                    getLayoutPermission().check(permissionChecker, plid, actionId);
032            }
033    
034            public static void check(
035                            PermissionChecker permissionChecker, long groupId,
036                            boolean privateLayout, long layoutId, String actionId)
037                    throws PortalException, SystemException {
038    
039                    getLayoutPermission().check(
040                            permissionChecker, groupId, privateLayout, layoutId, actionId);
041            }
042    
043            public static void check(
044                            PermissionChecker permissionChecker, Layout layout, String actionId)
045                    throws PortalException, SystemException {
046    
047                    getLayoutPermission().check(permissionChecker, layout, actionId);
048            }
049    
050            public static boolean contains(
051                            PermissionChecker permissionChecker, long plid, String actionId)
052                    throws PortalException, SystemException {
053    
054                    return getLayoutPermission().contains(
055                            permissionChecker, plid, actionId);
056            }
057    
058            public static boolean contains(
059                            PermissionChecker permissionChecker, long groupId,
060                            boolean privateLayout, long layoutId, String actionId)
061                    throws PortalException, SystemException {
062    
063                    return getLayoutPermission().contains(
064                            permissionChecker, groupId, privateLayout, layoutId, actionId);
065            }
066    
067            public static boolean contains(
068                            PermissionChecker permissionChecker, Layout layout, String actionId)
069                    throws PortalException, SystemException {
070    
071                    return getLayoutPermission().contains(
072                            permissionChecker, layout, actionId);
073            }
074    
075            public static LayoutPermission getLayoutPermission() {
076                    return _layoutPermission;
077            }
078    
079            public void setLayoutPermission(LayoutPermission layoutPermission) {
080                    _layoutPermission = layoutPermission;
081            }
082    
083            private static LayoutPermission _layoutPermission;
084    
085    }