1
19
20 package com.liferay.portal.service;
21
22
23
44 public class PermissionServiceUtil {
45 public static void checkPermission(long groupId, long resourceId)
46 throws com.liferay.portal.PortalException,
47 com.liferay.portal.SystemException {
48 getService().checkPermission(groupId, resourceId);
49 }
50
51 public static void checkPermission(long groupId, java.lang.String name,
52 long primKey)
53 throws com.liferay.portal.PortalException,
54 com.liferay.portal.SystemException {
55 getService().checkPermission(groupId, name, primKey);
56 }
57
58 public static void checkPermission(long groupId, java.lang.String name,
59 java.lang.String primKey)
60 throws com.liferay.portal.PortalException,
61 com.liferay.portal.SystemException {
62 getService().checkPermission(groupId, name, primKey);
63 }
64
65 public static boolean hasGroupPermission(long groupId,
66 java.lang.String actionId, long resourceId)
67 throws com.liferay.portal.SystemException {
68 return getService().hasGroupPermission(groupId, actionId, resourceId);
69 }
70
71 public static boolean hasUserPermission(long userId,
72 java.lang.String actionId, long resourceId)
73 throws com.liferay.portal.SystemException {
74 return getService().hasUserPermission(userId, actionId, resourceId);
75 }
76
77 public static boolean hasUserPermissions(long userId, long groupId,
78 java.util.List<com.liferay.portal.model.Resource> resources,
79 java.lang.String actionId,
80 com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
81 throws com.liferay.portal.PortalException,
82 com.liferay.portal.SystemException {
83 return getService()
84 .hasUserPermissions(userId, groupId, resources, actionId,
85 permissionCheckerBag);
86 }
87
88 public static void setGroupPermissions(long groupId,
89 java.lang.String[] actionIds, long resourceId)
90 throws com.liferay.portal.PortalException,
91 com.liferay.portal.SystemException {
92 getService().setGroupPermissions(groupId, actionIds, resourceId);
93 }
94
95 public static void setGroupPermissions(java.lang.String className,
96 java.lang.String classPK, long groupId, java.lang.String[] actionIds,
97 long resourceId)
98 throws com.liferay.portal.PortalException,
99 com.liferay.portal.SystemException {
100 getService()
101 .setGroupPermissions(className, classPK, groupId, actionIds,
102 resourceId);
103 }
104
105 public static void setOrgGroupPermissions(long organizationId,
106 long groupId, java.lang.String[] actionIds, long resourceId)
107 throws com.liferay.portal.PortalException,
108 com.liferay.portal.SystemException {
109 getService()
110 .setOrgGroupPermissions(organizationId, groupId, actionIds,
111 resourceId);
112 }
113
114 public static void setRolePermission(long roleId, long groupId,
115 java.lang.String name, int scope, java.lang.String primKey,
116 java.lang.String actionId)
117 throws com.liferay.portal.PortalException,
118 com.liferay.portal.SystemException {
119 getService()
120 .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
121 }
122
123 public static void setRolePermissions(long roleId, long groupId,
124 java.lang.String[] actionIds, long resourceId)
125 throws com.liferay.portal.PortalException,
126 com.liferay.portal.SystemException {
127 getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
128 }
129
130 public static void setUserPermissions(long userId, long groupId,
131 java.lang.String[] actionIds, long resourceId)
132 throws com.liferay.portal.PortalException,
133 com.liferay.portal.SystemException {
134 getService().setUserPermissions(userId, groupId, actionIds, resourceId);
135 }
136
137 public static void unsetRolePermission(long roleId, long groupId,
138 long permissionId)
139 throws com.liferay.portal.PortalException,
140 com.liferay.portal.SystemException {
141 getService().unsetRolePermission(roleId, groupId, permissionId);
142 }
143
144 public static void unsetRolePermission(long roleId, long groupId,
145 java.lang.String name, int scope, java.lang.String primKey,
146 java.lang.String actionId)
147 throws com.liferay.portal.PortalException,
148 com.liferay.portal.SystemException {
149 getService()
150 .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
151 }
152
153 public static void unsetRolePermissions(long roleId, long groupId,
154 java.lang.String name, int scope, java.lang.String actionId)
155 throws com.liferay.portal.PortalException,
156 com.liferay.portal.SystemException {
157 getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
158 }
159
160 public static void unsetUserPermissions(long userId, long groupId,
161 java.lang.String[] actionIds, long resourceId)
162 throws com.liferay.portal.PortalException,
163 com.liferay.portal.SystemException {
164 getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
165 }
166
167 public static PermissionService getService() {
168 if (_service == null) {
169 throw new RuntimeException("PermissionService is not set");
170 }
171
172 return _service;
173 }
174
175 public void setService(PermissionService service) {
176 _service = service;
177 }
178
179 private static PermissionService _service;
180 }