001
014
015 package com.liferay.portal.service.permission;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018 import com.liferay.portal.security.auth.PrincipalException;
019 import com.liferay.portal.security.permission.PermissionChecker;
020
021
024 public class UserPermissionUtil {
025
026
029 public static void check(
030 PermissionChecker permissionChecker, long userId,
031 long organizationId, long locationId, String actionId)
032 throws PrincipalException {
033
034 check(
035 permissionChecker, userId, new long[] {organizationId, locationId},
036 actionId);
037 }
038
039 public static void check(
040 PermissionChecker permissionChecker, long userId,
041 long[] organizationIds, String actionId)
042 throws PrincipalException {
043
044 getUserPermission().check(
045 permissionChecker, userId, organizationIds, actionId);
046 }
047
048 public static void check(
049 PermissionChecker permissionChecker, long userId, String actionId)
050 throws PrincipalException {
051
052 getUserPermission().check(permissionChecker, userId, actionId);
053 }
054
055
058 public static boolean contains(
059 PermissionChecker permissionChecker, long userId, long organizationId,
060 long locationId, String actionId) {
061
062 return contains(
063 permissionChecker, userId, new long[] {organizationId, locationId},
064 actionId);
065 }
066
067 public static boolean contains(
068 PermissionChecker permissionChecker, long userId,
069 long[] organizationIds, String actionId) {
070
071 return getUserPermission().contains(
072 permissionChecker, userId, organizationIds, actionId);
073 }
074
075 public static boolean contains(
076 PermissionChecker permissionChecker, long userId, String actionId) {
077
078 return getUserPermission().contains(
079 permissionChecker, userId, actionId);
080 }
081
082 public static UserPermission getUserPermission() {
083 PortalRuntimePermission.checkGetBeanProperty(UserPermissionUtil.class);
084
085 return _userPermission;
086 }
087
088 public void setUserPermission(UserPermission userPermission) {
089 PortalRuntimePermission.checkSetBeanProperty(getClass());
090
091 _userPermission = userPermission;
092 }
093
094 private static UserPermission _userPermission;
095
096 }