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