1
14
15 package com.liferay.portal.service.http;
16
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portal.kernel.util.MethodHandler;
20 import com.liferay.portal.kernel.util.MethodKey;
21 import com.liferay.portal.security.auth.HttpPrincipal;
22 import com.liferay.portal.service.PermissionServiceUtil;
23
24
61 public class PermissionServiceHttp {
62 public static void checkPermission(HttpPrincipal httpPrincipal,
63 long groupId, long resourceId)
64 throws com.liferay.portal.PortalException,
65 com.liferay.portal.SystemException {
66 try {
67 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
68 "checkPermission", _checkPermissionParameterTypes0);
69
70 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
71 resourceId);
72
73 try {
74 TunnelUtil.invoke(httpPrincipal, methodHandler);
75 }
76 catch (Exception e) {
77 if (e instanceof com.liferay.portal.PortalException) {
78 throw (com.liferay.portal.PortalException)e;
79 }
80
81 if (e instanceof com.liferay.portal.SystemException) {
82 throw (com.liferay.portal.SystemException)e;
83 }
84
85 throw new com.liferay.portal.SystemException(e);
86 }
87 }
88 catch (com.liferay.portal.SystemException se) {
89 _log.error(se, se);
90
91 throw se;
92 }
93 }
94
95 public static void checkPermission(HttpPrincipal httpPrincipal,
96 long groupId, java.lang.String name, long primKey)
97 throws com.liferay.portal.PortalException,
98 com.liferay.portal.SystemException {
99 try {
100 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
101 "checkPermission", _checkPermissionParameterTypes1);
102
103 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
104 name, primKey);
105
106 try {
107 TunnelUtil.invoke(httpPrincipal, methodHandler);
108 }
109 catch (Exception e) {
110 if (e instanceof com.liferay.portal.PortalException) {
111 throw (com.liferay.portal.PortalException)e;
112 }
113
114 if (e instanceof com.liferay.portal.SystemException) {
115 throw (com.liferay.portal.SystemException)e;
116 }
117
118 throw new com.liferay.portal.SystemException(e);
119 }
120 }
121 catch (com.liferay.portal.SystemException se) {
122 _log.error(se, se);
123
124 throw se;
125 }
126 }
127
128 public static void checkPermission(HttpPrincipal httpPrincipal,
129 long groupId, java.lang.String name, java.lang.String primKey)
130 throws com.liferay.portal.PortalException,
131 com.liferay.portal.SystemException {
132 try {
133 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
134 "checkPermission", _checkPermissionParameterTypes2);
135
136 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
137 name, primKey);
138
139 try {
140 TunnelUtil.invoke(httpPrincipal, methodHandler);
141 }
142 catch (Exception e) {
143 if (e instanceof com.liferay.portal.PortalException) {
144 throw (com.liferay.portal.PortalException)e;
145 }
146
147 if (e instanceof com.liferay.portal.SystemException) {
148 throw (com.liferay.portal.SystemException)e;
149 }
150
151 throw new com.liferay.portal.SystemException(e);
152 }
153 }
154 catch (com.liferay.portal.SystemException se) {
155 _log.error(se, se);
156
157 throw se;
158 }
159 }
160
161 public static boolean hasGroupPermission(HttpPrincipal httpPrincipal,
162 long groupId, java.lang.String actionId, long resourceId)
163 throws com.liferay.portal.SystemException {
164 try {
165 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
166 "hasGroupPermission", _hasGroupPermissionParameterTypes3);
167
168 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
169 actionId, resourceId);
170
171 Object returnObj = null;
172
173 try {
174 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
175 }
176 catch (Exception e) {
177 if (e instanceof com.liferay.portal.SystemException) {
178 throw (com.liferay.portal.SystemException)e;
179 }
180
181 throw new com.liferay.portal.SystemException(e);
182 }
183
184 return ((Boolean)returnObj).booleanValue();
185 }
186 catch (com.liferay.portal.SystemException se) {
187 _log.error(se, se);
188
189 throw se;
190 }
191 }
192
193 public static boolean hasUserPermission(HttpPrincipal httpPrincipal,
194 long userId, java.lang.String actionId, long resourceId)
195 throws com.liferay.portal.SystemException {
196 try {
197 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
198 "hasUserPermission", _hasUserPermissionParameterTypes4);
199
200 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
201 actionId, resourceId);
202
203 Object returnObj = null;
204
205 try {
206 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
207 }
208 catch (Exception e) {
209 if (e instanceof com.liferay.portal.SystemException) {
210 throw (com.liferay.portal.SystemException)e;
211 }
212
213 throw new com.liferay.portal.SystemException(e);
214 }
215
216 return ((Boolean)returnObj).booleanValue();
217 }
218 catch (com.liferay.portal.SystemException se) {
219 _log.error(se, se);
220
221 throw se;
222 }
223 }
224
225 public static boolean hasUserPermissions(HttpPrincipal httpPrincipal,
226 long userId, long groupId,
227 java.util.List<com.liferay.portal.model.Resource> resources,
228 java.lang.String actionId,
229 com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
230 throws com.liferay.portal.PortalException,
231 com.liferay.portal.SystemException {
232 try {
233 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
234 "hasUserPermissions", _hasUserPermissionsParameterTypes5);
235
236 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
237 groupId, resources, actionId, permissionCheckerBag);
238
239 Object returnObj = null;
240
241 try {
242 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
243 }
244 catch (Exception e) {
245 if (e instanceof com.liferay.portal.PortalException) {
246 throw (com.liferay.portal.PortalException)e;
247 }
248
249 if (e instanceof com.liferay.portal.SystemException) {
250 throw (com.liferay.portal.SystemException)e;
251 }
252
253 throw new com.liferay.portal.SystemException(e);
254 }
255
256 return ((Boolean)returnObj).booleanValue();
257 }
258 catch (com.liferay.portal.SystemException se) {
259 _log.error(se, se);
260
261 throw se;
262 }
263 }
264
265 public static void setGroupPermissions(HttpPrincipal httpPrincipal,
266 long groupId, java.lang.String[] actionIds, long resourceId)
267 throws com.liferay.portal.PortalException,
268 com.liferay.portal.SystemException {
269 try {
270 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
271 "setGroupPermissions", _setGroupPermissionsParameterTypes6);
272
273 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
274 actionIds, resourceId);
275
276 try {
277 TunnelUtil.invoke(httpPrincipal, methodHandler);
278 }
279 catch (Exception e) {
280 if (e instanceof com.liferay.portal.PortalException) {
281 throw (com.liferay.portal.PortalException)e;
282 }
283
284 if (e instanceof com.liferay.portal.SystemException) {
285 throw (com.liferay.portal.SystemException)e;
286 }
287
288 throw new com.liferay.portal.SystemException(e);
289 }
290 }
291 catch (com.liferay.portal.SystemException se) {
292 _log.error(se, se);
293
294 throw se;
295 }
296 }
297
298 public static void setGroupPermissions(HttpPrincipal httpPrincipal,
299 java.lang.String className, java.lang.String classPK, long groupId,
300 java.lang.String[] actionIds, long resourceId)
301 throws com.liferay.portal.PortalException,
302 com.liferay.portal.SystemException {
303 try {
304 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
305 "setGroupPermissions", _setGroupPermissionsParameterTypes7);
306
307 MethodHandler methodHandler = new MethodHandler(methodKey,
308 className, classPK, groupId, actionIds, resourceId);
309
310 try {
311 TunnelUtil.invoke(httpPrincipal, methodHandler);
312 }
313 catch (Exception e) {
314 if (e instanceof com.liferay.portal.PortalException) {
315 throw (com.liferay.portal.PortalException)e;
316 }
317
318 if (e instanceof com.liferay.portal.SystemException) {
319 throw (com.liferay.portal.SystemException)e;
320 }
321
322 throw new com.liferay.portal.SystemException(e);
323 }
324 }
325 catch (com.liferay.portal.SystemException se) {
326 _log.error(se, se);
327
328 throw se;
329 }
330 }
331
332 public static void setOrgGroupPermissions(HttpPrincipal httpPrincipal,
333 long organizationId, long groupId, java.lang.String[] actionIds,
334 long resourceId)
335 throws com.liferay.portal.PortalException,
336 com.liferay.portal.SystemException {
337 try {
338 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
339 "setOrgGroupPermissions",
340 _setOrgGroupPermissionsParameterTypes8);
341
342 MethodHandler methodHandler = new MethodHandler(methodKey,
343 organizationId, groupId, actionIds, resourceId);
344
345 try {
346 TunnelUtil.invoke(httpPrincipal, methodHandler);
347 }
348 catch (Exception e) {
349 if (e instanceof com.liferay.portal.PortalException) {
350 throw (com.liferay.portal.PortalException)e;
351 }
352
353 if (e instanceof com.liferay.portal.SystemException) {
354 throw (com.liferay.portal.SystemException)e;
355 }
356
357 throw new com.liferay.portal.SystemException(e);
358 }
359 }
360 catch (com.liferay.portal.SystemException se) {
361 _log.error(se, se);
362
363 throw se;
364 }
365 }
366
367 public static void setRolePermission(HttpPrincipal httpPrincipal,
368 long roleId, long groupId, java.lang.String name, int scope,
369 java.lang.String primKey, java.lang.String actionId)
370 throws com.liferay.portal.PortalException,
371 com.liferay.portal.SystemException {
372 try {
373 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
374 "setRolePermission", _setRolePermissionParameterTypes9);
375
376 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
377 groupId, name, scope, primKey, actionId);
378
379 try {
380 TunnelUtil.invoke(httpPrincipal, methodHandler);
381 }
382 catch (Exception e) {
383 if (e instanceof com.liferay.portal.PortalException) {
384 throw (com.liferay.portal.PortalException)e;
385 }
386
387 if (e instanceof com.liferay.portal.SystemException) {
388 throw (com.liferay.portal.SystemException)e;
389 }
390
391 throw new com.liferay.portal.SystemException(e);
392 }
393 }
394 catch (com.liferay.portal.SystemException se) {
395 _log.error(se, se);
396
397 throw se;
398 }
399 }
400
401 public static void setRolePermissions(HttpPrincipal httpPrincipal,
402 long roleId, long groupId, java.lang.String[] actionIds, long resourceId)
403 throws com.liferay.portal.PortalException,
404 com.liferay.portal.SystemException {
405 try {
406 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
407 "setRolePermissions", _setRolePermissionsParameterTypes10);
408
409 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
410 groupId, actionIds, resourceId);
411
412 try {
413 TunnelUtil.invoke(httpPrincipal, methodHandler);
414 }
415 catch (Exception e) {
416 if (e instanceof com.liferay.portal.PortalException) {
417 throw (com.liferay.portal.PortalException)e;
418 }
419
420 if (e instanceof com.liferay.portal.SystemException) {
421 throw (com.liferay.portal.SystemException)e;
422 }
423
424 throw new com.liferay.portal.SystemException(e);
425 }
426 }
427 catch (com.liferay.portal.SystemException se) {
428 _log.error(se, se);
429
430 throw se;
431 }
432 }
433
434 public static void setUserPermissions(HttpPrincipal httpPrincipal,
435 long userId, long groupId, java.lang.String[] actionIds, long resourceId)
436 throws com.liferay.portal.PortalException,
437 com.liferay.portal.SystemException {
438 try {
439 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
440 "setUserPermissions", _setUserPermissionsParameterTypes11);
441
442 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
443 groupId, actionIds, resourceId);
444
445 try {
446 TunnelUtil.invoke(httpPrincipal, methodHandler);
447 }
448 catch (Exception e) {
449 if (e instanceof com.liferay.portal.PortalException) {
450 throw (com.liferay.portal.PortalException)e;
451 }
452
453 if (e instanceof com.liferay.portal.SystemException) {
454 throw (com.liferay.portal.SystemException)e;
455 }
456
457 throw new com.liferay.portal.SystemException(e);
458 }
459 }
460 catch (com.liferay.portal.SystemException se) {
461 _log.error(se, se);
462
463 throw se;
464 }
465 }
466
467 public static void unsetRolePermission(HttpPrincipal httpPrincipal,
468 long roleId, long groupId, long permissionId)
469 throws com.liferay.portal.PortalException,
470 com.liferay.portal.SystemException {
471 try {
472 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
473 "unsetRolePermission", _unsetRolePermissionParameterTypes12);
474
475 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
476 groupId, permissionId);
477
478 try {
479 TunnelUtil.invoke(httpPrincipal, methodHandler);
480 }
481 catch (Exception e) {
482 if (e instanceof com.liferay.portal.PortalException) {
483 throw (com.liferay.portal.PortalException)e;
484 }
485
486 if (e instanceof com.liferay.portal.SystemException) {
487 throw (com.liferay.portal.SystemException)e;
488 }
489
490 throw new com.liferay.portal.SystemException(e);
491 }
492 }
493 catch (com.liferay.portal.SystemException se) {
494 _log.error(se, se);
495
496 throw se;
497 }
498 }
499
500 public static void unsetRolePermission(HttpPrincipal httpPrincipal,
501 long roleId, long groupId, java.lang.String name, int scope,
502 java.lang.String primKey, java.lang.String actionId)
503 throws com.liferay.portal.PortalException,
504 com.liferay.portal.SystemException {
505 try {
506 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
507 "unsetRolePermission", _unsetRolePermissionParameterTypes13);
508
509 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
510 groupId, name, scope, primKey, actionId);
511
512 try {
513 TunnelUtil.invoke(httpPrincipal, methodHandler);
514 }
515 catch (Exception e) {
516 if (e instanceof com.liferay.portal.PortalException) {
517 throw (com.liferay.portal.PortalException)e;
518 }
519
520 if (e instanceof com.liferay.portal.SystemException) {
521 throw (com.liferay.portal.SystemException)e;
522 }
523
524 throw new com.liferay.portal.SystemException(e);
525 }
526 }
527 catch (com.liferay.portal.SystemException se) {
528 _log.error(se, se);
529
530 throw se;
531 }
532 }
533
534 public static void unsetRolePermissions(HttpPrincipal httpPrincipal,
535 long roleId, long groupId, java.lang.String name, int scope,
536 java.lang.String actionId)
537 throws com.liferay.portal.PortalException,
538 com.liferay.portal.SystemException {
539 try {
540 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
541 "unsetRolePermissions",
542 _unsetRolePermissionsParameterTypes14);
543
544 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
545 groupId, name, scope, actionId);
546
547 try {
548 TunnelUtil.invoke(httpPrincipal, methodHandler);
549 }
550 catch (Exception e) {
551 if (e instanceof com.liferay.portal.PortalException) {
552 throw (com.liferay.portal.PortalException)e;
553 }
554
555 if (e instanceof com.liferay.portal.SystemException) {
556 throw (com.liferay.portal.SystemException)e;
557 }
558
559 throw new com.liferay.portal.SystemException(e);
560 }
561 }
562 catch (com.liferay.portal.SystemException se) {
563 _log.error(se, se);
564
565 throw se;
566 }
567 }
568
569 public static void unsetUserPermissions(HttpPrincipal httpPrincipal,
570 long userId, long groupId, java.lang.String[] actionIds, long resourceId)
571 throws com.liferay.portal.PortalException,
572 com.liferay.portal.SystemException {
573 try {
574 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
575 "unsetUserPermissions",
576 _unsetUserPermissionsParameterTypes15);
577
578 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
579 groupId, actionIds, resourceId);
580
581 try {
582 TunnelUtil.invoke(httpPrincipal, methodHandler);
583 }
584 catch (Exception e) {
585 if (e instanceof com.liferay.portal.PortalException) {
586 throw (com.liferay.portal.PortalException)e;
587 }
588
589 if (e instanceof com.liferay.portal.SystemException) {
590 throw (com.liferay.portal.SystemException)e;
591 }
592
593 throw new com.liferay.portal.SystemException(e);
594 }
595 }
596 catch (com.liferay.portal.SystemException se) {
597 _log.error(se, se);
598
599 throw se;
600 }
601 }
602
603 private static Log _log = LogFactoryUtil.getLog(PermissionServiceHttp.class);
604 private static final Class<?>[] _checkPermissionParameterTypes0 = new Class[] {
605 long.class, long.class
606 };
607 private static final Class<?>[] _checkPermissionParameterTypes1 = new Class[] {
608 long.class, java.lang.String.class, long.class
609 };
610 private static final Class<?>[] _checkPermissionParameterTypes2 = new Class[] {
611 long.class, java.lang.String.class, java.lang.String.class
612 };
613 private static final Class<?>[] _hasGroupPermissionParameterTypes3 = new Class[] {
614 long.class, java.lang.String.class, long.class
615 };
616 private static final Class<?>[] _hasUserPermissionParameterTypes4 = new Class[] {
617 long.class, java.lang.String.class, long.class
618 };
619 private static final Class<?>[] _hasUserPermissionsParameterTypes5 = new Class[] {
620 long.class, long.class, java.util.List.class, java.lang.String.class,
621 com.liferay.portal.security.permission.PermissionCheckerBag.class
622 };
623 private static final Class<?>[] _setGroupPermissionsParameterTypes6 = new Class[] {
624 long.class, java.lang.String[].class, long.class
625 };
626 private static final Class<?>[] _setGroupPermissionsParameterTypes7 = new Class[] {
627 java.lang.String.class, java.lang.String.class, long.class,
628 java.lang.String[].class, long.class
629 };
630 private static final Class<?>[] _setOrgGroupPermissionsParameterTypes8 = new Class[] {
631 long.class, long.class, java.lang.String[].class, long.class
632 };
633 private static final Class<?>[] _setRolePermissionParameterTypes9 = new Class[] {
634 long.class, long.class, java.lang.String.class, int.class,
635 java.lang.String.class, java.lang.String.class
636 };
637 private static final Class<?>[] _setRolePermissionsParameterTypes10 = new Class[] {
638 long.class, long.class, java.lang.String[].class, long.class
639 };
640 private static final Class<?>[] _setUserPermissionsParameterTypes11 = new Class[] {
641 long.class, long.class, java.lang.String[].class, long.class
642 };
643 private static final Class<?>[] _unsetRolePermissionParameterTypes12 = new Class[] {
644 long.class, long.class, long.class
645 };
646 private static final Class<?>[] _unsetRolePermissionParameterTypes13 = new Class[] {
647 long.class, long.class, java.lang.String.class, int.class,
648 java.lang.String.class, java.lang.String.class
649 };
650 private static final Class<?>[] _unsetRolePermissionsParameterTypes14 = new Class[] {
651 long.class, long.class, java.lang.String.class, int.class,
652 java.lang.String.class
653 };
654 private static final Class<?>[] _unsetUserPermissionsParameterTypes15 = new Class[] {
655 long.class, long.class, java.lang.String[].class, long.class
656 };
657 }