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;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.ReferenceRegistry;
019    
020    /**
021     * 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.
022     *
023     * <p>
024     * 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.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see PermissionService
029     * @see com.liferay.portal.service.base.PermissionServiceBaseImpl
030     * @see com.liferay.portal.service.impl.PermissionServiceImpl
031     * @generated
032     */
033    public class PermissionServiceUtil {
034            /*
035             * NOTE FOR DEVELOPERS:
036             *
037             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionServiceImpl} and rerun ServiceBuilder to regenerate this class.
038             */
039    
040            /**
041            * Returns the Spring bean ID for this bean.
042            *
043            * @return the Spring bean ID for this bean
044            */
045            public static java.lang.String getBeanIdentifier() {
046                    return getService().getBeanIdentifier();
047            }
048    
049            /**
050            * Sets the Spring bean ID for this bean.
051            *
052            * @param beanIdentifier the Spring bean ID for this bean
053            */
054            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
055                    getService().setBeanIdentifier(beanIdentifier);
056            }
057    
058            /**
059            * Checks to see if the group has permission to the resource.
060            *
061            * @param groupId the primary key of the group
062            * @param resourceId the primary key of the resource
063            * @throws PortalException if the group did not have permission to the
064            resource, or if a group or resource with the primary key could
065            not be found or was invalid
066            * @throws SystemException if a system exception occurred
067            */
068            public static void checkPermission(long groupId, long resourceId)
069                    throws com.liferay.portal.kernel.exception.PortalException,
070                            com.liferay.portal.kernel.exception.SystemException {
071                    getService().checkPermission(groupId, resourceId);
072            }
073    
074            /**
075            * Checks to see if the group has permission to the service.
076            *
077            * @param groupId the primary key of the group
078            * @param name the service name
079            * @param primKey the primary key of the service
080            * @throws PortalException if the group did not have permission to the
081            service, if a group with the primary key could not be found or if
082            the permission information was invalid
083            * @throws SystemException if a system exception occurred
084            */
085            public static void checkPermission(long groupId, java.lang.String name,
086                    long primKey)
087                    throws com.liferay.portal.kernel.exception.PortalException,
088                            com.liferay.portal.kernel.exception.SystemException {
089                    getService().checkPermission(groupId, name, primKey);
090            }
091    
092            /**
093            * Checks to see if the group has permission to the service.
094            *
095            * @param groupId the primary key of the group
096            * @param name the service name
097            * @param primKey the primary key of the service
098            * @throws PortalException if the group did not have permission to the
099            service, if a group with the primary key could not be found or if
100            the permission information was invalid
101            * @throws SystemException if a system exception occurred
102            */
103            public static void checkPermission(long groupId, java.lang.String name,
104                    java.lang.String primKey)
105                    throws com.liferay.portal.kernel.exception.PortalException,
106                            com.liferay.portal.kernel.exception.SystemException {
107                    getService().checkPermission(groupId, name, primKey);
108            }
109    
110            /**
111            * Returns <code>true</code> if the group has permission to perform the
112            * action on the resource.
113            *
114            * @param groupId the primary key of the group
115            * @param actionId the action's ID
116            * @param resourceId the primary key of the resource
117            * @return <code>true</code> if the group has permission to perform the
118            action on the resource; <code>false</code> otherwise
119            * @throws SystemException if a system exception occurred
120            */
121            public static boolean hasGroupPermission(long groupId,
122                    java.lang.String actionId, long resourceId)
123                    throws com.liferay.portal.kernel.exception.SystemException {
124                    return getService().hasGroupPermission(groupId, actionId, resourceId);
125            }
126    
127            /**
128            * Returns <code>true</code> if the user has permission to perform the
129            * action on the resource.
130            *
131            * @param userId the primary key of the user
132            * @param actionId the action's ID
133            * @param resourceId the primary key of the resource
134            * @return <code>true</code> if the user has permission to perform the
135            action on the resource; <code>false</code> otherwise
136            * @throws SystemException if a system exception occurred
137            */
138            public static boolean hasUserPermission(long userId,
139                    java.lang.String actionId, long resourceId)
140                    throws com.liferay.portal.kernel.exception.SystemException {
141                    return getService().hasUserPermission(userId, actionId, resourceId);
142            }
143    
144            /**
145            * Returns <code>true</code> if the user has permission to perform the
146            * action on the resources.
147            *
148            * <p>
149            * This method does not support resources managed by the resource block
150            * system.
151            * </p>
152            *
153            * @param userId the primary key of the user
154            * @param groupId the primary key of the group containing the resource
155            * @param resources representations of the resource at each scope level
156            returned by {@link
157            com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources(
158            long, long, String, String, String)}
159            * @param actionId the action's ID
160            * @param permissionCheckerBag the permission checker bag
161            * @return <code>true</code> if the user has permission to perform the
162            action on the resources; <code>false</code> otherwise
163            * @throws PortalException if a resource action based on any one of the
164            resources and the action ID could not be found
165            * @throws SystemException if a system exception occurred
166            */
167            public static boolean hasUserPermissions(long userId, long groupId,
168                    java.util.List<com.liferay.portal.model.Resource> resources,
169                    java.lang.String actionId,
170                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
171                    throws com.liferay.portal.kernel.exception.PortalException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getService()
174                                       .hasUserPermissions(userId, groupId, resources, actionId,
175                            permissionCheckerBag);
176            }
177    
178            /**
179            * Sets the group's permissions to perform the actions on the resource,
180            * replacing the group's existing permissions on the resource.
181            *
182            * @param groupId the primary key of the group
183            * @param actionIds the primary keys of the actions
184            * @param resourceId the primary key of the resource
185            * @throws PortalException if a group with the primary key could not be
186            found or if the group did not have permission to the resource
187            * @throws SystemException if a system exception occurred
188            */
189            public static void setGroupPermissions(long groupId,
190                    java.lang.String[] actionIds, long resourceId)
191                    throws com.liferay.portal.kernel.exception.PortalException,
192                            com.liferay.portal.kernel.exception.SystemException {
193                    getService().setGroupPermissions(groupId, actionIds, resourceId);
194            }
195    
196            /**
197            * Sets the entity's group permissions to perform the actions on the
198            * resource, replacing the entity's existing group permissions on the
199            * resource. Only {@link com.liferay.portal.model.Organization} and {@link
200            * com.liferay.portal.model.UserGroup} class entities are supported.
201            *
202            * @param className the class name of an organization or user group
203            * @param classPK the primary key of the class
204            * @param groupId the primary key of the group
205            * @param actionIds the primary keys of the actions
206            * @param resourceId the primary key of the resource
207            * @throws PortalException if the group did not have permission to the
208            resource, if an entity with the class name and primary key could
209            not be found, or if the entity's associated group could not be
210            found
211            * @throws SystemException if a system exception occurred
212            */
213            public static void setGroupPermissions(java.lang.String className,
214                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
215                    long resourceId)
216                    throws com.liferay.portal.kernel.exception.PortalException,
217                            com.liferay.portal.kernel.exception.SystemException {
218                    getService()
219                            .setGroupPermissions(className, classPK, groupId, actionIds,
220                            resourceId);
221            }
222    
223            /**
224            * Sets the permissions of each role to perform respective actions on the
225            * resource, replacing the existing permissions of each role on the
226            * resource.
227            *
228            * @param groupId the primary key of the group
229            * @param companyId the primary key of the company
230            * @param roleIdsToActionIds the map of roles to their new actions on the
231            resource
232            * @param resourceId the primary key of the resource
233            * @throws PortalException if the group did not have permission to the
234            resource
235            * @throws SystemException if a system exception occurred
236            */
237            public static void setIndividualPermissions(long groupId, long companyId,
238                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
239                    long resourceId)
240                    throws com.liferay.portal.kernel.exception.PortalException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    getService()
243                            .setIndividualPermissions(groupId, companyId, roleIdsToActionIds,
244                            resourceId);
245            }
246    
247            /**
248            * Sets the organization permission to perform the actions on the resource
249            * for a particular group, replacing the organization's existing permissions
250            * on the resource.
251            *
252            * @param organizationId the primary key of the organization
253            * @param groupId the primary key of the group in which to scope the
254            permissions
255            * @param actionIds the primary keys of the actions
256            * @param resourceId the primary key of the resource
257            * @throws PortalException if the group did not have permission to the
258            resource or if an organization with the primary key could not be
259            found
260            * @throws SystemException if a system exception occurred
261            */
262            public static void setOrgGroupPermissions(long organizationId,
263                    long groupId, java.lang.String[] actionIds, long resourceId)
264                    throws com.liferay.portal.kernel.exception.PortalException,
265                            com.liferay.portal.kernel.exception.SystemException {
266                    getService()
267                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
268                            resourceId);
269            }
270    
271            /**
272            * Sets the role's permissions to perform the action on the named resource,
273            * replacing the role's existing permissions on the resource.
274            *
275            * @param roleId the primary key of the role
276            * @param groupId the primary key of the group
277            * @param name the resource name
278            * @param scope the resource scope
279            * @param primKey the resource primKey
280            * @param actionId the action's ID
281            * @throws PortalException if the group did not have permission to the role
282            or if the scope was {@link
283            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
284            * @throws SystemException if a system exception occurred
285            */
286            public static void setRolePermission(long roleId, long groupId,
287                    java.lang.String name, int scope, java.lang.String primKey,
288                    java.lang.String actionId)
289                    throws com.liferay.portal.kernel.exception.PortalException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    getService()
292                            .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
293            }
294    
295            /**
296            * Sets the role's permissions to perform the actions on the resource,
297            * replacing the role's existing permissions on the resource.
298            *
299            * @param roleId the primary key of the role
300            * @param groupId the primary key of the group
301            * @param actionIds the primary keys of the actions
302            * @param resourceId the primary key of the resource
303            * @throws PortalException if the group did not have permission to the
304            resource or if a role with the primary key could not be found
305            * @throws SystemException if a system exception occurred
306            */
307            public static void setRolePermissions(long roleId, long groupId,
308                    java.lang.String[] actionIds, long resourceId)
309                    throws com.liferay.portal.kernel.exception.PortalException,
310                            com.liferay.portal.kernel.exception.SystemException {
311                    getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
312            }
313    
314            /**
315            * Sets the user's permissions to perform the actions on the resource,
316            * replacing the user's existing permissions on the resource.
317            *
318            * @param userId the primary key of the user
319            * @param groupId the primary key of the group
320            * @param actionIds the primary keys of the actions
321            * @param resourceId the primary key of the resource
322            * @throws PortalException if the group did not have permission to the
323            resource or if a user with the primary key could not be found
324            * @throws SystemException if a system exception occurred
325            */
326            public static void setUserPermissions(long userId, long groupId,
327                    java.lang.String[] actionIds, long resourceId)
328                    throws com.liferay.portal.kernel.exception.PortalException,
329                            com.liferay.portal.kernel.exception.SystemException {
330                    getService().setUserPermissions(userId, groupId, actionIds, resourceId);
331            }
332    
333            /**
334            * Removes the permission from the role.
335            *
336            * @param roleId the primary key of the role
337            * @param groupId the primary key of the group
338            * @param permissionId the primary key of the permission
339            * @throws PortalException if the group did not have permission to the role
340            * @throws SystemException if a system exception occurred
341            */
342            public static void unsetRolePermission(long roleId, long groupId,
343                    long permissionId)
344                    throws com.liferay.portal.kernel.exception.PortalException,
345                            com.liferay.portal.kernel.exception.SystemException {
346                    getService().unsetRolePermission(roleId, groupId, permissionId);
347            }
348    
349            /**
350            * Removes the role's permissions to perform the action on the named
351            * resource with the scope and primKey.
352            *
353            * @param roleId the primary key of the role
354            * @param groupId the primary key of the group
355            * @param name the resource name
356            * @param scope the resource scope
357            * @param primKey the resource primKey
358            * @param actionId the action's ID
359            * @throws PortalException if the group did not have permission to the role
360            * @throws SystemException if a system exception occurred
361            */
362            public static void unsetRolePermission(long roleId, long groupId,
363                    java.lang.String name, int scope, java.lang.String primKey,
364                    java.lang.String actionId)
365                    throws com.liferay.portal.kernel.exception.PortalException,
366                            com.liferay.portal.kernel.exception.SystemException {
367                    getService()
368                            .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
369            }
370    
371            /**
372            * Removes the role's permissions to perform the action on the named
373            * resource.
374            *
375            * @param roleId the primary key of the role
376            * @param groupId the primary key of the group
377            * @param name the resource name
378            * @param scope the resource scope
379            * @param actionId the action's ID
380            * @throws PortalException if the group did not have permission to the role
381            * @throws SystemException if a system exception occurred
382            */
383            public static void unsetRolePermissions(long roleId, long groupId,
384                    java.lang.String name, int scope, java.lang.String actionId)
385                    throws com.liferay.portal.kernel.exception.PortalException,
386                            com.liferay.portal.kernel.exception.SystemException {
387                    getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
388            }
389    
390            /**
391            * Removes the user's permissions to perform the actions on the resource.
392            *
393            * @param userId the primary key of the user
394            * @param groupId the primary key of the group
395            * @param actionIds the primary keys of the actions
396            * @param resourceId the primary key of the resource
397            * @throws PortalException if the group did not have permission to the
398            resource
399            * @throws SystemException if a system exception occurred
400            */
401            public static void unsetUserPermissions(long userId, long groupId,
402                    java.lang.String[] actionIds, long resourceId)
403                    throws com.liferay.portal.kernel.exception.PortalException,
404                            com.liferay.portal.kernel.exception.SystemException {
405                    getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
406            }
407    
408            public static PermissionService getService() {
409                    if (_service == null) {
410                            _service = (PermissionService)PortalBeanLocatorUtil.locate(PermissionService.class.getName());
411    
412                            ReferenceRegistry.registerReference(PermissionServiceUtil.class,
413                                    "_service");
414                    }
415    
416                    return _service;
417            }
418    
419            /**
420             * @deprecated
421             */
422            public void setService(PermissionService service) {
423            }
424    
425            private static PermissionService _service;
426    }