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