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