001    /**
002     * Copyright (c) 2000-2011 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;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the permission remote service. This utility wraps {@link com.liferay.portal.service.impl.PermissionServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see PermissionService
030     * @see com.liferay.portal.service.base.PermissionServiceBaseImpl
031     * @see com.liferay.portal.service.impl.PermissionServiceImpl
032     * @generated
033     */
034    public class PermissionServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040            public static void checkPermission(long groupId, long resourceId)
041                    throws com.liferay.portal.kernel.exception.PortalException,
042                            com.liferay.portal.kernel.exception.SystemException {
043                    getService().checkPermission(groupId, resourceId);
044            }
045    
046            public static void checkPermission(long groupId, java.lang.String name,
047                    long primKey)
048                    throws com.liferay.portal.kernel.exception.PortalException,
049                            com.liferay.portal.kernel.exception.SystemException {
050                    getService().checkPermission(groupId, name, primKey);
051            }
052    
053            public static void checkPermission(long groupId, java.lang.String name,
054                    java.lang.String primKey)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    getService().checkPermission(groupId, name, primKey);
058            }
059    
060            public static boolean hasGroupPermission(long groupId,
061                    java.lang.String actionId, long resourceId)
062                    throws com.liferay.portal.kernel.exception.SystemException {
063                    return getService().hasGroupPermission(groupId, actionId, resourceId);
064            }
065    
066            public static boolean hasUserPermission(long userId,
067                    java.lang.String actionId, long resourceId)
068                    throws com.liferay.portal.kernel.exception.SystemException {
069                    return getService().hasUserPermission(userId, actionId, resourceId);
070            }
071    
072            public static boolean hasUserPermissions(long userId, long groupId,
073                    java.util.List<com.liferay.portal.model.Resource> resources,
074                    java.lang.String actionId,
075                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
076                    throws com.liferay.portal.kernel.exception.PortalException,
077                            com.liferay.portal.kernel.exception.SystemException {
078                    return getService()
079                                       .hasUserPermissions(userId, groupId, resources, actionId,
080                            permissionCheckerBag);
081            }
082    
083            public static void setGroupPermissions(long groupId,
084                    java.lang.String[] actionIds, long resourceId)
085                    throws com.liferay.portal.kernel.exception.PortalException,
086                            com.liferay.portal.kernel.exception.SystemException {
087                    getService().setGroupPermissions(groupId, actionIds, resourceId);
088            }
089    
090            public static void setGroupPermissions(java.lang.String className,
091                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
092                    long resourceId)
093                    throws com.liferay.portal.kernel.exception.PortalException,
094                            com.liferay.portal.kernel.exception.SystemException {
095                    getService()
096                            .setGroupPermissions(className, classPK, groupId, actionIds,
097                            resourceId);
098            }
099    
100            public static void setOrgGroupPermissions(long organizationId,
101                    long groupId, java.lang.String[] actionIds, long resourceId)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    getService()
105                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
106                            resourceId);
107            }
108    
109            public static void setRolePermission(long roleId, long groupId,
110                    java.lang.String name, int scope, java.lang.String primKey,
111                    java.lang.String actionId)
112                    throws com.liferay.portal.kernel.exception.PortalException,
113                            com.liferay.portal.kernel.exception.SystemException {
114                    getService()
115                            .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
116            }
117    
118            public static void setRolePermissions(long roleId, long groupId,
119                    java.lang.String[] actionIds, long resourceId)
120                    throws com.liferay.portal.kernel.exception.PortalException,
121                            com.liferay.portal.kernel.exception.SystemException {
122                    getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
123            }
124    
125            public static void setUserPermissions(long userId, long groupId,
126                    java.lang.String[] actionIds, long resourceId)
127                    throws com.liferay.portal.kernel.exception.PortalException,
128                            com.liferay.portal.kernel.exception.SystemException {
129                    getService().setUserPermissions(userId, groupId, actionIds, resourceId);
130            }
131    
132            public static void unsetRolePermission(long roleId, long groupId,
133                    long permissionId)
134                    throws com.liferay.portal.kernel.exception.PortalException,
135                            com.liferay.portal.kernel.exception.SystemException {
136                    getService().unsetRolePermission(roleId, groupId, permissionId);
137            }
138    
139            public static void unsetRolePermission(long roleId, long groupId,
140                    java.lang.String name, int scope, java.lang.String primKey,
141                    java.lang.String actionId)
142                    throws com.liferay.portal.kernel.exception.PortalException,
143                            com.liferay.portal.kernel.exception.SystemException {
144                    getService()
145                            .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
146            }
147    
148            public static void unsetRolePermissions(long roleId, long groupId,
149                    java.lang.String name, int scope, java.lang.String actionId)
150                    throws com.liferay.portal.kernel.exception.PortalException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
153            }
154    
155            public static void unsetUserPermissions(long userId, long groupId,
156                    java.lang.String[] actionIds, long resourceId)
157                    throws com.liferay.portal.kernel.exception.PortalException,
158                            com.liferay.portal.kernel.exception.SystemException {
159                    getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
160            }
161    
162            public static PermissionService getService() {
163                    if (_service == null) {
164                            _service = (PermissionService)PortalBeanLocatorUtil.locate(PermissionService.class.getName());
165    
166                            ReferenceRegistry.registerReference(PermissionServiceUtil.class,
167                                    "_service");
168                            MethodCache.remove(PermissionService.class);
169                    }
170    
171                    return _service;
172            }
173    
174            public void setService(PermissionService service) {
175                    MethodCache.remove(PermissionService.class);
176    
177                    _service = service;
178    
179                    ReferenceRegistry.registerReference(PermissionServiceUtil.class,
180                            "_service");
181                    MethodCache.remove(PermissionService.class);
182            }
183    
184            private static PermissionService _service;
185    }