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.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.service.PermissionServiceUtil;
020    
021    import java.rmi.RemoteException;
022    
023    /**
024     * <p>
025     * This class provides a SOAP utility for the
026     * {@link com.liferay.portal.service.PermissionServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it is difficult for SOAP to
029     * support certain types.
030     * </p>
031     *
032     * <p>
033     * ServiceBuilder follows certain rules in translating the methods. For example,
034     * if the method in the service utility returns a {@link java.util.List}, that
035     * is translated to an array of {@link com.liferay.portal.model.PermissionSoap}.
036     * If the method in the service utility returns a
037     * {@link com.liferay.portal.model.Permission}, that is translated to a
038     * {@link com.liferay.portal.model.PermissionSoap}. Methods that SOAP cannot
039     * safely wire are skipped.
040     * </p>
041     *
042     * <p>
043     * The benefits of using the SOAP utility is that it is cross platform
044     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
045     * even Perl, to call the generated services. One drawback of SOAP is that it is
046     * slow because it needs to serialize all calls into a text format (XML).
047     * </p>
048     *
049     * <p>
050     * You can see a list of services at
051     * http://localhost:8080/api/secure/axis. Set the property
052     * <b>axis.servlet.hosts.allowed</b> in portal.properties to configure
053     * security.
054     * </p>
055     *
056     * <p>
057     * The SOAP utility is only generated for remote services.
058     * </p>
059     *
060     * @author    Brian Wing Shun Chan
061     * @see       PermissionServiceHttp
062     * @see       com.liferay.portal.model.PermissionSoap
063     * @see       com.liferay.portal.service.PermissionServiceUtil
064     * @generated
065     */
066    public class PermissionServiceSoap {
067            /**
068            * Checks to see if the group has permission to the resource.
069            *
070            * @param groupId the primary key of the group
071            * @param resourceId the primary key of the resource
072            * @throws PortalException if the group did not have permission to the
073            resource, or if a group or resource with the primary key could
074            not be found or was invalid
075            * @throws SystemException if a system exception occurred
076            */
077            public static void checkPermission(long groupId, long resourceId)
078                    throws RemoteException {
079                    try {
080                            PermissionServiceUtil.checkPermission(groupId, resourceId);
081                    }
082                    catch (Exception e) {
083                            _log.error(e, e);
084    
085                            throw new RemoteException(e.getMessage());
086                    }
087            }
088    
089            /**
090            * Checks to see if the group has permission to the service.
091            *
092            * @param groupId the primary key of the group
093            * @param name the service name
094            * @param primKey the primary key of the service
095            * @throws PortalException if the group did not have permission to the
096            service, if a group with the primary key could not be found or if
097            the permission information was invalid
098            * @throws SystemException if a system exception occurred
099            */
100            public static void checkPermission(long groupId, java.lang.String name,
101                    long primKey) throws RemoteException {
102                    try {
103                            PermissionServiceUtil.checkPermission(groupId, name, primKey);
104                    }
105                    catch (Exception e) {
106                            _log.error(e, e);
107    
108                            throw new RemoteException(e.getMessage());
109                    }
110            }
111    
112            /**
113            * Checks to see if the group has permission to the service.
114            *
115            * @param groupId the primary key of the group
116            * @param name the service name
117            * @param primKey the primary key of the service
118            * @throws PortalException if the group did not have permission to the
119            service, if a group with the primary key could not be found or if
120            the permission information was invalid
121            * @throws SystemException if a system exception occurred
122            */
123            public static void checkPermission(long groupId, java.lang.String name,
124                    java.lang.String primKey) throws RemoteException {
125                    try {
126                            PermissionServiceUtil.checkPermission(groupId, name, primKey);
127                    }
128                    catch (Exception e) {
129                            _log.error(e, e);
130    
131                            throw new RemoteException(e.getMessage());
132                    }
133            }
134    
135            /**
136            * Returns <code>true</code> if the group has permission to perform the
137            * action on the resource.
138            *
139            * @param groupId the primary key of the group
140            * @param actionId the action's ID
141            * @param resourceId the primary key of the resource
142            * @return <code>true</code> if the group has permission to perform the
143            action on the resource; <code>false</code> otherwise
144            * @throws SystemException if a system exception occurred
145            */
146            public static boolean hasGroupPermission(long groupId,
147                    java.lang.String actionId, long resourceId) throws RemoteException {
148                    try {
149                            boolean returnValue = PermissionServiceUtil.hasGroupPermission(groupId,
150                                            actionId, resourceId);
151    
152                            return returnValue;
153                    }
154                    catch (Exception e) {
155                            _log.error(e, e);
156    
157                            throw new RemoteException(e.getMessage());
158                    }
159            }
160    
161            /**
162            * Returns <code>true</code> if the user has permission to perform the
163            * action on the resource.
164            *
165            * @param userId the primary key of the user
166            * @param actionId the action's ID
167            * @param resourceId the primary key of the resource
168            * @return <code>true</code> if the user has permission to perform the
169            action on the resource; <code>false</code> otherwise
170            * @throws SystemException if a system exception occurred
171            */
172            public static boolean hasUserPermission(long userId,
173                    java.lang.String actionId, long resourceId) throws RemoteException {
174                    try {
175                            boolean returnValue = PermissionServiceUtil.hasUserPermission(userId,
176                                            actionId, resourceId);
177    
178                            return returnValue;
179                    }
180                    catch (Exception e) {
181                            _log.error(e, e);
182    
183                            throw new RemoteException(e.getMessage());
184                    }
185            }
186    
187            /**
188            * Returns <code>true</code> if the user has permission to perform the
189            * action on the resources.
190            *
191            * <p>
192            * This method does not support resources managed by the resource block
193            * system.
194            * </p>
195            *
196            * @param userId the primary key of the user
197            * @param groupId the primary key of the group containing the resource
198            * @param resources representations of the resource at each scope level
199            returned by {@link
200            com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources(
201            long, long, String, String, String)}
202            * @param actionId the action's ID
203            * @param permissionCheckerBag the permission checker bag
204            * @return <code>true</code> if the user has permission to perform the
205            action on the resources; <code>false</code> otherwise
206            * @throws PortalException if a resource action based on any one of the
207            resources and the action ID could not be found
208            * @throws SystemException if a system exception occurred
209            */
210            public static boolean hasUserPermissions(long userId, long groupId,
211                    com.liferay.portal.model.ResourceSoap[] resources,
212                    java.lang.String actionId,
213                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
214                    throws RemoteException {
215                    try {
216                            boolean returnValue = PermissionServiceUtil.hasUserPermissions(userId,
217                                            groupId,
218                                            com.liferay.portal.model.impl.ResourceModelImpl.toModels(
219                                                    resources), actionId, permissionCheckerBag);
220    
221                            return returnValue;
222                    }
223                    catch (Exception e) {
224                            _log.error(e, e);
225    
226                            throw new RemoteException(e.getMessage());
227                    }
228            }
229    
230            /**
231            * Sets the group's permissions to perform the actions on the resource,
232            * replacing the group's existing permissions on the resource.
233            *
234            * @param groupId the primary key of the group
235            * @param actionIds the primary keys of the actions
236            * @param resourceId the primary key of the resource
237            * @throws PortalException if a group with the primary key could not be
238            found or if the group did not have permission to the resource
239            * @throws SystemException if a system exception occurred
240            */
241            public static void setGroupPermissions(long groupId,
242                    java.lang.String[] actionIds, long resourceId)
243                    throws RemoteException {
244                    try {
245                            PermissionServiceUtil.setGroupPermissions(groupId, actionIds,
246                                    resourceId);
247                    }
248                    catch (Exception e) {
249                            _log.error(e, e);
250    
251                            throw new RemoteException(e.getMessage());
252                    }
253            }
254    
255            /**
256            * Sets the entity's group permissions to perform the actions on the
257            * resource, replacing the entity's existing group permissions on the
258            * resource. Only {@link com.liferay.portal.model.Organization} and {@link
259            * com.liferay.portal.model.UserGroup} class entities are supported.
260            *
261            * @param className the class name of an organization or user group
262            * @param classPK the primary key of the class
263            * @param groupId the primary key of the group
264            * @param actionIds the primary keys of the actions
265            * @param resourceId the primary key of the resource
266            * @throws PortalException if the group did not have permission to the
267            resource, if an entity with the class name and primary key could
268            not be found, or if the entity's associated group could not be
269            found
270            * @throws SystemException if a system exception occurred
271            */
272            public static void setGroupPermissions(java.lang.String className,
273                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
274                    long resourceId) throws RemoteException {
275                    try {
276                            PermissionServiceUtil.setGroupPermissions(className, classPK,
277                                    groupId, actionIds, resourceId);
278                    }
279                    catch (Exception e) {
280                            _log.error(e, e);
281    
282                            throw new RemoteException(e.getMessage());
283                    }
284            }
285    
286            /**
287            * Sets the organization permission to perform the actions on the resource
288            * for a particular group, replacing the organization's existing permissions
289            * on the resource.
290            *
291            * @param organizationId the primary key of the organization
292            * @param groupId the primary key of the group in which to scope the
293            permissions
294            * @param actionIds the primary keys of the actions
295            * @param resourceId the primary key of the resource
296            * @throws PortalException if the group did not have permission to the
297            resource or if an organization with the primary key could not be
298            found
299            * @throws SystemException if a system exception occurred
300            */
301            public static void setOrgGroupPermissions(long organizationId,
302                    long groupId, java.lang.String[] actionIds, long resourceId)
303                    throws RemoteException {
304                    try {
305                            PermissionServiceUtil.setOrgGroupPermissions(organizationId,
306                                    groupId, actionIds, resourceId);
307                    }
308                    catch (Exception e) {
309                            _log.error(e, e);
310    
311                            throw new RemoteException(e.getMessage());
312                    }
313            }
314    
315            /**
316            * Sets the role's permissions to perform the action on the named resource,
317            * replacing the role's existing permissions on the resource.
318            *
319            * @param roleId the primary key of the role
320            * @param groupId the primary key of the group
321            * @param name the resource name
322            * @param scope the resource scope
323            * @param primKey the resource primKey
324            * @param actionId the action's ID
325            * @throws PortalException if the group did not have permission to the role
326            or if the scope was {@link
327            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
328            * @throws SystemException if a system exception occurred
329            */
330            public static void setRolePermission(long roleId, long groupId,
331                    java.lang.String name, int scope, java.lang.String primKey,
332                    java.lang.String actionId) throws RemoteException {
333                    try {
334                            PermissionServiceUtil.setRolePermission(roleId, groupId, name,
335                                    scope, primKey, actionId);
336                    }
337                    catch (Exception e) {
338                            _log.error(e, e);
339    
340                            throw new RemoteException(e.getMessage());
341                    }
342            }
343    
344            /**
345            * Sets the role's permissions to perform the actions on the resource,
346            * replacing the role's existing permissions on the resource.
347            *
348            * @param roleId the primary key of the role
349            * @param groupId the primary key of the group
350            * @param actionIds the primary keys of the actions
351            * @param resourceId the primary key of the resource
352            * @throws PortalException if the group did not have permission to the
353            resource or if a role with the primary key could not be found
354            * @throws SystemException if a system exception occurred
355            */
356            public static void setRolePermissions(long roleId, long groupId,
357                    java.lang.String[] actionIds, long resourceId)
358                    throws RemoteException {
359                    try {
360                            PermissionServiceUtil.setRolePermissions(roleId, groupId,
361                                    actionIds, resourceId);
362                    }
363                    catch (Exception e) {
364                            _log.error(e, e);
365    
366                            throw new RemoteException(e.getMessage());
367                    }
368            }
369    
370            /**
371            * Sets the user's permissions to perform the actions on the resource,
372            * replacing the user's existing permissions on the resource.
373            *
374            * @param userId the primary key of the user
375            * @param groupId the primary key of the group
376            * @param actionIds the primary keys of the actions
377            * @param resourceId the primary key of the resource
378            * @throws PortalException if the group did not have permission to the
379            resource or if a user with the primary key could not be found
380            * @throws SystemException if a system exception occurred
381            */
382            public static void setUserPermissions(long userId, long groupId,
383                    java.lang.String[] actionIds, long resourceId)
384                    throws RemoteException {
385                    try {
386                            PermissionServiceUtil.setUserPermissions(userId, groupId,
387                                    actionIds, resourceId);
388                    }
389                    catch (Exception e) {
390                            _log.error(e, e);
391    
392                            throw new RemoteException(e.getMessage());
393                    }
394            }
395    
396            /**
397            * Removes the permission from the role.
398            *
399            * @param roleId the primary key of the role
400            * @param groupId the primary key of the group
401            * @param permissionId the primary key of the permission
402            * @throws PortalException if the group did not have permission to the role
403            * @throws SystemException if a system exception occurred
404            */
405            public static void unsetRolePermission(long roleId, long groupId,
406                    long permissionId) throws RemoteException {
407                    try {
408                            PermissionServiceUtil.unsetRolePermission(roleId, groupId,
409                                    permissionId);
410                    }
411                    catch (Exception e) {
412                            _log.error(e, e);
413    
414                            throw new RemoteException(e.getMessage());
415                    }
416            }
417    
418            /**
419            * Removes the role's permissions to perform the action on the named
420            * resource with the scope and primKey.
421            *
422            * @param roleId the primary key of the role
423            * @param groupId the primary key of the group
424            * @param name the resource name
425            * @param scope the resource scope
426            * @param primKey the resource primKey
427            * @param actionId the action's ID
428            * @throws PortalException if the group did not have permission to the role
429            * @throws SystemException if a system exception occurred
430            */
431            public static void unsetRolePermission(long roleId, long groupId,
432                    java.lang.String name, int scope, java.lang.String primKey,
433                    java.lang.String actionId) throws RemoteException {
434                    try {
435                            PermissionServiceUtil.unsetRolePermission(roleId, groupId, name,
436                                    scope, primKey, actionId);
437                    }
438                    catch (Exception e) {
439                            _log.error(e, e);
440    
441                            throw new RemoteException(e.getMessage());
442                    }
443            }
444    
445            /**
446            * Removes the role's permissions to perform the action on the named
447            * resource.
448            *
449            * @param roleId the primary key of the role
450            * @param groupId the primary key of the group
451            * @param name the resource name
452            * @param scope the resource scope
453            * @param actionId the action's ID
454            * @throws PortalException if the group did not have permission to the role
455            * @throws SystemException if a system exception occurred
456            */
457            public static void unsetRolePermissions(long roleId, long groupId,
458                    java.lang.String name, int scope, java.lang.String actionId)
459                    throws RemoteException {
460                    try {
461                            PermissionServiceUtil.unsetRolePermissions(roleId, groupId, name,
462                                    scope, actionId);
463                    }
464                    catch (Exception e) {
465                            _log.error(e, e);
466    
467                            throw new RemoteException(e.getMessage());
468                    }
469            }
470    
471            /**
472            * Removes the user's permissions to perform the actions on the resource.
473            *
474            * @param userId the primary key of the user
475            * @param groupId the primary key of the group
476            * @param actionIds the primary keys of the actions
477            * @param resourceId the primary key of the resource
478            * @throws PortalException if the group did not have permission to the
479            resource
480            * @throws SystemException if a system exception occurred
481            */
482            public static void unsetUserPermissions(long userId, long groupId,
483                    java.lang.String[] actionIds, long resourceId)
484                    throws RemoteException {
485                    try {
486                            PermissionServiceUtil.unsetUserPermissions(userId, groupId,
487                                    actionIds, resourceId);
488                    }
489                    catch (Exception e) {
490                            _log.error(e, e);
491    
492                            throw new RemoteException(e.getMessage());
493                    }
494            }
495    
496            private static Log _log = LogFactoryUtil.getLog(PermissionServiceSoap.class);
497    }