001    /**
002     * Copyright (c) 2000-2013 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.expando.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.security.permission.PermissionChecker;
021    import com.liferay.portlet.expando.model.ExpandoColumn;
022    
023    /**
024     * @author Michael C. Han
025     */
026    public class ExpandoColumnPermissionUtil {
027    
028            public static void check(
029                            PermissionChecker permissionChecker, ExpandoColumn column,
030                            String actionId)
031                    throws PortalException {
032    
033                    getExpandoColumnPermission().check(permissionChecker, column, actionId);
034            }
035    
036            public static void check(
037                            PermissionChecker permissionChecker, long columnId, String actionId)
038                    throws PortalException, SystemException {
039    
040                    getExpandoColumnPermission().check(
041                            permissionChecker, columnId, actionId);
042            }
043    
044            public static void check(
045                            PermissionChecker permissionChecker, long companyId,
046                            String className, String tableName, String columnName,
047                            String actionId)
048                    throws PortalException, SystemException {
049    
050                    getExpandoColumnPermission().check(
051                            permissionChecker, companyId, className, tableName, columnName,
052                            actionId);
053            }
054    
055            public static boolean contains(
056                    PermissionChecker permissionChecker, ExpandoColumn column,
057                    String actionId) {
058    
059                    return getExpandoColumnPermission().contains(
060                            permissionChecker, column, actionId);
061            }
062    
063            public static boolean contains(
064                            PermissionChecker permissionChecker, long columnId, String actionId)
065                    throws PortalException, SystemException {
066    
067                    return getExpandoColumnPermission().contains(
068                            permissionChecker, columnId, actionId);
069            }
070    
071            public static boolean contains(
072                            PermissionChecker permissionChecker, long companyId,
073                            String className, String tableName, String columnName,
074                            String actionId)
075                    throws SystemException {
076    
077                    return getExpandoColumnPermission().contains(
078                            permissionChecker, companyId, className, tableName, columnName,
079                            actionId);
080            }
081    
082            public static ExpandoColumnPermission getExpandoColumnPermission() {
083                    return _expandoColumnPermission;
084            }
085    
086            public void setExpandoColumnPermission(
087                    ExpandoColumnPermission expandoColumnPermission) {
088    
089                    PortalRuntimePermission.checkSetBeanProperty(getClass());
090    
091                    _expandoColumnPermission = expandoColumnPermission;
092            }
093    
094            private static ExpandoColumnPermission _expandoColumnPermission;
095    
096    }