1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.service.PermissionServiceUtil;
28  
29  import java.rmi.RemoteException;
30  
31  /**
32   * <a href="PermissionServiceSoap.java.html"><b><i>View Source</i></b></a>
33   *
34   * <p>
35   * ServiceBuilder generated this class. Modifications in this class will be overwritten
36   * the next time is generated.
37   * </p>
38   *
39   * <p>
40   * This class provides a SOAP utility for the <code>com.liferay.portal.service.PermissionServiceUtil</code>
41   * service utility. The static methods of this class calls the same methods of the
42   * service utility. However, the signatures are different because it is difficult
43   * for SOAP to support certain types.
44   * </p>
45   *
46   * <p>
47   * ServiceBuilder follows certain rules in translating the methods. For example,
48   * if the method in the service utility returns a <code>java.util.List</code>, that
49   * is translated to an array of <code>com.liferay.portal.model.PermissionSoap</code>.
50   * If the method in the service utility returns a <code>com.liferay.portal.model.Permission</code>,
51   * that is translated to a <code>com.liferay.portal.model.PermissionSoap</code>.
52   * Methods that SOAP cannot safely wire are skipped.
53   * </p>
54   *
55   * <p>
56   * The benefits of using the SOAP utility is that it is cross platform compatible.
57   * SOAP allows different languages like Java, .NET, C++, PHP, and even Perl, to
58   * call the generated services. One drawback of SOAP is that it is slow because
59   * it needs to serialize all calls into a text format (XML).
60   * </p>
61   *
62   * <p>
63   * You can see a list of services at http://localhost:8080/tunnel-web/secure/axis.
64   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
65   * to configure security.
66   * </p>
67   *
68   * <p>
69   * The SOAP utility is only generated for remote services.
70   * </p>
71   *
72   * @author Brian Wing Shun Chan
73   *
74   * @see com.liferay.portal.service.PermissionServiceUtil
75   * @see com.liferay.portal.service.http.PermissionServiceHttp
76   * @see com.liferay.portal.service.model.PermissionSoap
77   *
78   */
79  public class PermissionServiceSoap {
80      public static void checkPermission(long groupId, java.lang.String name,
81          java.lang.String primKey) throws RemoteException {
82          try {
83              PermissionServiceUtil.checkPermission(groupId, name, primKey);
84          }
85          catch (Exception e) {
86              _log.error(e, e);
87              throw new RemoteException(e.getMessage());
88          }
89      }
90  
91      public static boolean hasGroupPermission(long groupId,
92          java.lang.String actionId, long resourceId) throws RemoteException {
93          try {
94              boolean returnValue = PermissionServiceUtil.hasGroupPermission(groupId,
95                      actionId, resourceId);
96  
97              return returnValue;
98          }
99          catch (Exception e) {
100             _log.error(e, e);
101             throw new RemoteException(e.getMessage());
102         }
103     }
104 
105     public static boolean hasUserPermission(long userId,
106         java.lang.String actionId, long resourceId) throws RemoteException {
107         try {
108             boolean returnValue = PermissionServiceUtil.hasUserPermission(userId,
109                     actionId, resourceId);
110 
111             return returnValue;
112         }
113         catch (Exception e) {
114             _log.error(e, e);
115             throw new RemoteException(e.getMessage());
116         }
117     }
118 
119     public static boolean hasUserPermissions(long userId, long groupId,
120         java.lang.String actionId, long[] resourceIds,
121         com.liferay.portal.kernel.security.permission.PermissionCheckerBag permissionCheckerBag)
122         throws RemoteException {
123         try {
124             boolean returnValue = PermissionServiceUtil.hasUserPermissions(userId,
125                     groupId, actionId, resourceIds, permissionCheckerBag);
126 
127             return returnValue;
128         }
129         catch (Exception e) {
130             _log.error(e, e);
131             throw new RemoteException(e.getMessage());
132         }
133     }
134 
135     public static void setGroupPermissions(long groupId,
136         java.lang.String[] actionIds, long resourceId)
137         throws RemoteException {
138         try {
139             PermissionServiceUtil.setGroupPermissions(groupId, actionIds,
140                 resourceId);
141         }
142         catch (Exception e) {
143             _log.error(e, e);
144             throw new RemoteException(e.getMessage());
145         }
146     }
147 
148     public static void setGroupPermissions(java.lang.String className,
149         java.lang.String classPK, long groupId, java.lang.String[] actionIds,
150         long resourceId) throws RemoteException {
151         try {
152             PermissionServiceUtil.setGroupPermissions(className, classPK,
153                 groupId, actionIds, resourceId);
154         }
155         catch (Exception e) {
156             _log.error(e, e);
157             throw new RemoteException(e.getMessage());
158         }
159     }
160 
161     public static void setOrgGroupPermissions(long organizationId,
162         long groupId, java.lang.String[] actionIds, long resourceId)
163         throws RemoteException {
164         try {
165             PermissionServiceUtil.setOrgGroupPermissions(organizationId,
166                 groupId, actionIds, resourceId);
167         }
168         catch (Exception e) {
169             _log.error(e, e);
170             throw new RemoteException(e.getMessage());
171         }
172     }
173 
174     public static void setRolePermission(long roleId, long groupId,
175         java.lang.String name, int scope, java.lang.String primKey,
176         java.lang.String actionId) throws RemoteException {
177         try {
178             PermissionServiceUtil.setRolePermission(roleId, groupId, name,
179                 scope, primKey, actionId);
180         }
181         catch (Exception e) {
182             _log.error(e, e);
183             throw new RemoteException(e.getMessage());
184         }
185     }
186 
187     public static void setUserPermissions(long userId, long groupId,
188         java.lang.String[] actionIds, long resourceId)
189         throws RemoteException {
190         try {
191             PermissionServiceUtil.setUserPermissions(userId, groupId,
192                 actionIds, resourceId);
193         }
194         catch (Exception e) {
195             _log.error(e, e);
196             throw new RemoteException(e.getMessage());
197         }
198     }
199 
200     public static void unsetRolePermission(long roleId, long groupId,
201         long permissionId) throws RemoteException {
202         try {
203             PermissionServiceUtil.unsetRolePermission(roleId, groupId,
204                 permissionId);
205         }
206         catch (Exception e) {
207             _log.error(e, e);
208             throw new RemoteException(e.getMessage());
209         }
210     }
211 
212     public static void unsetRolePermission(long roleId, long groupId,
213         java.lang.String name, int scope, java.lang.String primKey,
214         java.lang.String actionId) throws RemoteException {
215         try {
216             PermissionServiceUtil.unsetRolePermission(roleId, groupId, name,
217                 scope, primKey, actionId);
218         }
219         catch (Exception e) {
220             _log.error(e, e);
221             throw new RemoteException(e.getMessage());
222         }
223     }
224 
225     public static void unsetRolePermissions(long roleId, long groupId,
226         java.lang.String name, int scope, java.lang.String actionId)
227         throws RemoteException {
228         try {
229             PermissionServiceUtil.unsetRolePermissions(roleId, groupId, name,
230                 scope, actionId);
231         }
232         catch (Exception e) {
233             _log.error(e, e);
234             throw new RemoteException(e.getMessage());
235         }
236     }
237 
238     public static void unsetUserPermissions(long userId, long groupId,
239         java.lang.String[] actionIds, long resourceId)
240         throws RemoteException {
241         try {
242             PermissionServiceUtil.unsetUserPermissions(userId, groupId,
243                 actionIds, resourceId);
244         }
245         catch (Exception e) {
246             _log.error(e, e);
247             throw new RemoteException(e.getMessage());
248         }
249     }
250 
251     private static Log _log = LogFactoryUtil.getLog(PermissionServiceSoap.class);
252 }