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.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.security.permission.PermissionChecker;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class CommonPermissionUtil {
026    
027            public static void check(
028                            PermissionChecker permissionChecker, long classNameId, long classPK,
029                            String actionId)
030                    throws PortalException, SystemException {
031    
032                    getCommonPermission().check(
033                            permissionChecker, classNameId, classPK, actionId);
034            }
035    
036            public static void check(
037                            PermissionChecker permissionChecker, String className, long classPK,
038                            String actionId)
039                    throws PortalException, SystemException {
040    
041                    getCommonPermission().check(
042                            permissionChecker, className, classPK, actionId);
043            }
044    
045            public static CommonPermission getCommonPermission() {
046                    PortalRuntimePermission.checkGetBeanProperty(
047                            CommonPermissionUtil.class);
048    
049                    return _commonPermission;
050            }
051    
052            public void setCommonPermission(CommonPermission commonPermission) {
053                    PortalRuntimePermission.checkSetBeanProperty(getClass());
054    
055                    _commonPermission = commonPermission;
056            }
057    
058            private static CommonPermission _commonPermission;
059    
060    }