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 setOrgGroupPermissions(HttpPrincipal httpPrincipal,
326 long organizationId, long groupId, java.lang.String[] actionIds,
327 long resourceId)
328 throws com.liferay.portal.kernel.exception.PortalException,
329 com.liferay.portal.kernel.exception.SystemException {
330 try {
331 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
332 "setOrgGroupPermissions",
333 _setOrgGroupPermissionsParameterTypes8);
334
335 MethodHandler methodHandler = new MethodHandler(methodKey,
336 organizationId, groupId, actionIds, resourceId);
337
338 try {
339 TunnelUtil.invoke(httpPrincipal, methodHandler);
340 }
341 catch (Exception e) {
342 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
343 throw (com.liferay.portal.kernel.exception.PortalException)e;
344 }
345
346 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
347 throw (com.liferay.portal.kernel.exception.SystemException)e;
348 }
349
350 throw new com.liferay.portal.kernel.exception.SystemException(e);
351 }
352 }
353 catch (com.liferay.portal.kernel.exception.SystemException se) {
354 _log.error(se, se);
355
356 throw se;
357 }
358 }
359
360 public static void setRolePermission(HttpPrincipal httpPrincipal,
361 long roleId, long groupId, java.lang.String name, int scope,
362 java.lang.String primKey, java.lang.String actionId)
363 throws com.liferay.portal.kernel.exception.PortalException,
364 com.liferay.portal.kernel.exception.SystemException {
365 try {
366 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
367 "setRolePermission", _setRolePermissionParameterTypes9);
368
369 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
370 groupId, name, scope, primKey, actionId);
371
372 try {
373 TunnelUtil.invoke(httpPrincipal, methodHandler);
374 }
375 catch (Exception e) {
376 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
377 throw (com.liferay.portal.kernel.exception.PortalException)e;
378 }
379
380 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
381 throw (com.liferay.portal.kernel.exception.SystemException)e;
382 }
383
384 throw new com.liferay.portal.kernel.exception.SystemException(e);
385 }
386 }
387 catch (com.liferay.portal.kernel.exception.SystemException se) {
388 _log.error(se, se);
389
390 throw se;
391 }
392 }
393
394 public static void setRolePermissions(HttpPrincipal httpPrincipal,
395 long roleId, long groupId, java.lang.String[] actionIds, long resourceId)
396 throws com.liferay.portal.kernel.exception.PortalException,
397 com.liferay.portal.kernel.exception.SystemException {
398 try {
399 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
400 "setRolePermissions", _setRolePermissionsParameterTypes10);
401
402 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
403 groupId, actionIds, resourceId);
404
405 try {
406 TunnelUtil.invoke(httpPrincipal, methodHandler);
407 }
408 catch (Exception e) {
409 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
410 throw (com.liferay.portal.kernel.exception.PortalException)e;
411 }
412
413 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
414 throw (com.liferay.portal.kernel.exception.SystemException)e;
415 }
416
417 throw new com.liferay.portal.kernel.exception.SystemException(e);
418 }
419 }
420 catch (com.liferay.portal.kernel.exception.SystemException se) {
421 _log.error(se, se);
422
423 throw se;
424 }
425 }
426
427 public static void setUserPermissions(HttpPrincipal httpPrincipal,
428 long userId, long groupId, java.lang.String[] actionIds, long resourceId)
429 throws com.liferay.portal.kernel.exception.PortalException,
430 com.liferay.portal.kernel.exception.SystemException {
431 try {
432 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
433 "setUserPermissions", _setUserPermissionsParameterTypes11);
434
435 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
436 groupId, actionIds, resourceId);
437
438 try {
439 TunnelUtil.invoke(httpPrincipal, methodHandler);
440 }
441 catch (Exception e) {
442 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
443 throw (com.liferay.portal.kernel.exception.PortalException)e;
444 }
445
446 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
447 throw (com.liferay.portal.kernel.exception.SystemException)e;
448 }
449
450 throw new com.liferay.portal.kernel.exception.SystemException(e);
451 }
452 }
453 catch (com.liferay.portal.kernel.exception.SystemException se) {
454 _log.error(se, se);
455
456 throw se;
457 }
458 }
459
460 public static void unsetRolePermission(HttpPrincipal httpPrincipal,
461 long roleId, long groupId, long permissionId)
462 throws com.liferay.portal.kernel.exception.PortalException,
463 com.liferay.portal.kernel.exception.SystemException {
464 try {
465 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
466 "unsetRolePermission", _unsetRolePermissionParameterTypes12);
467
468 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
469 groupId, permissionId);
470
471 try {
472 TunnelUtil.invoke(httpPrincipal, methodHandler);
473 }
474 catch (Exception e) {
475 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
476 throw (com.liferay.portal.kernel.exception.PortalException)e;
477 }
478
479 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
480 throw (com.liferay.portal.kernel.exception.SystemException)e;
481 }
482
483 throw new com.liferay.portal.kernel.exception.SystemException(e);
484 }
485 }
486 catch (com.liferay.portal.kernel.exception.SystemException se) {
487 _log.error(se, se);
488
489 throw se;
490 }
491 }
492
493 public static void unsetRolePermission(HttpPrincipal httpPrincipal,
494 long roleId, long groupId, java.lang.String name, int scope,
495 java.lang.String primKey, java.lang.String actionId)
496 throws com.liferay.portal.kernel.exception.PortalException,
497 com.liferay.portal.kernel.exception.SystemException {
498 try {
499 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
500 "unsetRolePermission", _unsetRolePermissionParameterTypes13);
501
502 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
503 groupId, name, scope, primKey, actionId);
504
505 try {
506 TunnelUtil.invoke(httpPrincipal, methodHandler);
507 }
508 catch (Exception e) {
509 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
510 throw (com.liferay.portal.kernel.exception.PortalException)e;
511 }
512
513 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
514 throw (com.liferay.portal.kernel.exception.SystemException)e;
515 }
516
517 throw new com.liferay.portal.kernel.exception.SystemException(e);
518 }
519 }
520 catch (com.liferay.portal.kernel.exception.SystemException se) {
521 _log.error(se, se);
522
523 throw se;
524 }
525 }
526
527 public static void unsetRolePermissions(HttpPrincipal httpPrincipal,
528 long roleId, long groupId, java.lang.String name, int scope,
529 java.lang.String actionId)
530 throws com.liferay.portal.kernel.exception.PortalException,
531 com.liferay.portal.kernel.exception.SystemException {
532 try {
533 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
534 "unsetRolePermissions",
535 _unsetRolePermissionsParameterTypes14);
536
537 MethodHandler methodHandler = new MethodHandler(methodKey, roleId,
538 groupId, name, scope, actionId);
539
540 try {
541 TunnelUtil.invoke(httpPrincipal, methodHandler);
542 }
543 catch (Exception e) {
544 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
545 throw (com.liferay.portal.kernel.exception.PortalException)e;
546 }
547
548 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
549 throw (com.liferay.portal.kernel.exception.SystemException)e;
550 }
551
552 throw new com.liferay.portal.kernel.exception.SystemException(e);
553 }
554 }
555 catch (com.liferay.portal.kernel.exception.SystemException se) {
556 _log.error(se, se);
557
558 throw se;
559 }
560 }
561
562 public static void unsetUserPermissions(HttpPrincipal httpPrincipal,
563 long userId, long groupId, java.lang.String[] actionIds, long resourceId)
564 throws com.liferay.portal.kernel.exception.PortalException,
565 com.liferay.portal.kernel.exception.SystemException {
566 try {
567 MethodKey methodKey = new MethodKey(PermissionServiceUtil.class.getName(),
568 "unsetUserPermissions",
569 _unsetUserPermissionsParameterTypes15);
570
571 MethodHandler methodHandler = new MethodHandler(methodKey, userId,
572 groupId, actionIds, resourceId);
573
574 try {
575 TunnelUtil.invoke(httpPrincipal, methodHandler);
576 }
577 catch (Exception e) {
578 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
579 throw (com.liferay.portal.kernel.exception.PortalException)e;
580 }
581
582 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
583 throw (com.liferay.portal.kernel.exception.SystemException)e;
584 }
585
586 throw new com.liferay.portal.kernel.exception.SystemException(e);
587 }
588 }
589 catch (com.liferay.portal.kernel.exception.SystemException se) {
590 _log.error(se, se);
591
592 throw se;
593 }
594 }
595
596 private static Log _log = LogFactoryUtil.getLog(PermissionServiceHttp.class);
597 private static final Class<?>[] _checkPermissionParameterTypes0 = new Class[] {
598 long.class, long.class
599 };
600 private static final Class<?>[] _checkPermissionParameterTypes1 = new Class[] {
601 long.class, java.lang.String.class, long.class
602 };
603 private static final Class<?>[] _checkPermissionParameterTypes2 = new Class[] {
604 long.class, java.lang.String.class, java.lang.String.class
605 };
606 private static final Class<?>[] _hasGroupPermissionParameterTypes3 = new Class[] {
607 long.class, java.lang.String.class, long.class
608 };
609 private static final Class<?>[] _hasUserPermissionParameterTypes4 = new Class[] {
610 long.class, java.lang.String.class, long.class
611 };
612 private static final Class<?>[] _hasUserPermissionsParameterTypes5 = new Class[] {
613 long.class, long.class, java.util.List.class, java.lang.String.class,
614 com.liferay.portal.security.permission.PermissionCheckerBag.class
615 };
616 private static final Class<?>[] _setGroupPermissionsParameterTypes6 = new Class[] {
617 long.class, java.lang.String[].class, long.class
618 };
619 private static final Class<?>[] _setGroupPermissionsParameterTypes7 = new Class[] {
620 java.lang.String.class, java.lang.String.class, long.class,
621 java.lang.String[].class, long.class
622 };
623 private static final Class<?>[] _setOrgGroupPermissionsParameterTypes8 = new Class[] {
624 long.class, long.class, java.lang.String[].class, long.class
625 };
626 private static final Class<?>[] _setRolePermissionParameterTypes9 = new Class[] {
627 long.class, long.class, java.lang.String.class, int.class,
628 java.lang.String.class, java.lang.String.class
629 };
630 private static final Class<?>[] _setRolePermissionsParameterTypes10 = new Class[] {
631 long.class, long.class, java.lang.String[].class, long.class
632 };
633 private static final Class<?>[] _setUserPermissionsParameterTypes11 = new Class[] {
634 long.class, long.class, java.lang.String[].class, long.class
635 };
636 private static final Class<?>[] _unsetRolePermissionParameterTypes12 = new Class[] {
637 long.class, long.class, long.class
638 };
639 private static final Class<?>[] _unsetRolePermissionParameterTypes13 = new Class[] {
640 long.class, long.class, java.lang.String.class, int.class,
641 java.lang.String.class, java.lang.String.class
642 };
643 private static final Class<?>[] _unsetRolePermissionsParameterTypes14 = new Class[] {
644 long.class, long.class, java.lang.String.class, int.class,
645 java.lang.String.class
646 };
647 private static final Class<?>[] _unsetUserPermissionsParameterTypes15 = new Class[] {
648 long.class, long.class, java.lang.String[].class, long.class
649 };
650 }