001
014
015 package com.liferay.portlet.usersadmin.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.search.Hits;
020 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
021 import com.liferay.portal.kernel.util.OrderByComparator;
022 import com.liferay.portal.kernel.util.Tuple;
023 import com.liferay.portal.model.Address;
024 import com.liferay.portal.model.EmailAddress;
025 import com.liferay.portal.model.Group;
026 import com.liferay.portal.model.OrgLabor;
027 import com.liferay.portal.model.Organization;
028 import com.liferay.portal.model.Phone;
029 import com.liferay.portal.model.Role;
030 import com.liferay.portal.model.User;
031 import com.liferay.portal.model.UserGroup;
032 import com.liferay.portal.model.UserGroupRole;
033 import com.liferay.portal.model.Website;
034 import com.liferay.portal.security.permission.PermissionChecker;
035
036 import java.util.List;
037
038 import javax.portlet.ActionRequest;
039 import javax.portlet.PortletRequest;
040 import javax.portlet.RenderResponse;
041
042 import javax.servlet.http.HttpServletRequest;
043
044
049 public class UsersAdminUtil {
050
051
054 public static final String CUSTOM_QUESTION = "write-my-own-question";
055
056 public static void addPortletBreadcrumbEntries(
057 Organization organization, HttpServletRequest request,
058 RenderResponse renderResponse)
059 throws Exception {
060
061 getUsersAdmin().addPortletBreadcrumbEntries(
062 organization, request, renderResponse);
063 }
064
065 public static long[] addRequiredRoles(long userId, long[] roleIds)
066 throws PortalException, SystemException {
067
068 return getUsersAdmin().addRequiredRoles(userId, roleIds);
069 }
070
071 public static long[] addRequiredRoles(User user, long[] roleIds)
072 throws PortalException, SystemException {
073
074 return getUsersAdmin().addRequiredRoles(user, roleIds);
075 }
076
077 public static List<Role> filterGroupRoles(
078 PermissionChecker permissionChecker, long groupId, List<Role> roles)
079 throws PortalException, SystemException {
080
081 return getUsersAdmin().filterGroupRoles(
082 permissionChecker, groupId, roles);
083 }
084
085 public static List<Group> filterGroups(
086 PermissionChecker permissionChecker, List<Group> groups)
087 throws PortalException, SystemException {
088
089 return getUsersAdmin().filterGroups(permissionChecker, groups);
090 }
091
092 public static List<Organization> filterOrganizations(
093 PermissionChecker permissionChecker,
094 List<Organization> organizations)
095 throws PortalException, SystemException {
096
097 return getUsersAdmin().filterOrganizations(
098 permissionChecker, organizations);
099 }
100
101 public static List<Role> filterRoles(
102 PermissionChecker permissionChecker, List<Role> roles) {
103
104 return getUsersAdmin().filterRoles(permissionChecker, roles);
105 }
106
107 public static long[] filterUnsetGroupUserIds(
108 PermissionChecker permissionChecker, long groupId, long[] userIds)
109 throws PortalException, SystemException {
110
111 return getUsersAdmin().filterUnsetGroupUserIds(
112 permissionChecker, groupId, userIds);
113 }
114
115 public static long[] filterUnsetOrganizationUserIds(
116 PermissionChecker permissionChecker, long organizationId,
117 long[] userIds)
118 throws PortalException, SystemException {
119
120 return getUsersAdmin().filterUnsetOrganizationUserIds(
121 permissionChecker, organizationId, userIds);
122 }
123
124 public static List<UserGroupRole> filterUserGroupRoles(
125 PermissionChecker permissionChecker,
126 List<UserGroupRole> userGroupRoles)
127 throws PortalException, SystemException {
128
129 return getUsersAdmin().filterUserGroupRoles(
130 permissionChecker, userGroupRoles);
131 }
132
133 public static List<UserGroup> filterUserGroups(
134 PermissionChecker permissionChecker, List<UserGroup> userGroups) {
135
136 return getUsersAdmin().filterUserGroups(permissionChecker, userGroups);
137 }
138
139 public static List<Address> getAddresses(ActionRequest actionRequest) {
140 return getUsersAdmin().getAddresses(actionRequest);
141 }
142
143 public static List<Address> getAddresses(
144 ActionRequest actionRequest, List<Address> defaultAddresses) {
145
146 return getUsersAdmin().getAddresses(actionRequest, defaultAddresses);
147 }
148
149 public static List<EmailAddress> getEmailAddresses(
150 ActionRequest actionRequest) {
151
152 return getUsersAdmin().getEmailAddresses(actionRequest);
153 }
154
155 public static List<EmailAddress> getEmailAddresses(
156 ActionRequest actionRequest, List<EmailAddress> defaultEmailAddresses) {
157
158 return getUsersAdmin().getEmailAddresses(
159 actionRequest, defaultEmailAddresses);
160 }
161
162 public static long[] getGroupIds(PortletRequest portletRequest)
163 throws PortalException, SystemException {
164
165 return getUsersAdmin().getGroupIds(portletRequest);
166 }
167
168 public static OrderByComparator getGroupOrderByComparator(
169 String orderByCol, String orderByType) {
170
171 return getUsersAdmin().getGroupOrderByComparator(
172 orderByCol, orderByType);
173 }
174
175 public static Long[] getOrganizationIds(List<Organization> organizations) {
176 return getUsersAdmin().getOrganizationIds(organizations);
177 }
178
179 public static long[] getOrganizationIds(PortletRequest portletRequest)
180 throws PortalException, SystemException {
181
182 return getUsersAdmin().getOrganizationIds(portletRequest);
183 }
184
185 public static OrderByComparator getOrganizationOrderByComparator(
186 String orderByCol, String orderByType) {
187
188 return getUsersAdmin().getOrganizationOrderByComparator(
189 orderByCol, orderByType);
190 }
191
192 public static Tuple getOrganizations(Hits hits)
193 throws PortalException, SystemException {
194
195 return getUsersAdmin().getOrganizations(hits);
196 }
197
198 public static List<OrgLabor> getOrgLabors(ActionRequest actionRequest) {
199 return getUsersAdmin().getOrgLabors(actionRequest);
200 }
201
202 public static List<Phone> getPhones(ActionRequest actionRequest) {
203 return getUsersAdmin().getPhones(actionRequest);
204 }
205
206 public static List<Phone> getPhones(
207 ActionRequest actionRequest, List<Phone> defaultPhones) {
208
209 return getUsersAdmin().getPhones(actionRequest, defaultPhones);
210 }
211
212 public static long[] getRoleIds(PortletRequest portletRequest)
213 throws PortalException, SystemException {
214
215 return getUsersAdmin().getRoleIds(portletRequest);
216 }
217
218 public static OrderByComparator getRoleOrderByComparator(
219 String orderByCol, String orderByType) {
220
221 return getUsersAdmin().getRoleOrderByComparator(
222 orderByCol, orderByType);
223 }
224
225 public static long[] getUserGroupIds(PortletRequest portletRequest)
226 throws PortalException, SystemException {
227
228 return getUsersAdmin().getUserGroupIds(portletRequest);
229 }
230
231 public static OrderByComparator getUserGroupOrderByComparator(
232 String orderByCol, String orderByType) {
233
234 return getUsersAdmin().getUserGroupOrderByComparator(
235 orderByCol, orderByType);
236 }
237
238 public static List<UserGroupRole> getUserGroupRoles(
239 PortletRequest portletRequest)
240 throws PortalException, SystemException {
241
242 return getUsersAdmin().getUserGroupRoles(portletRequest);
243 }
244
245 public static Tuple getUserGroups(Hits hits)
246 throws PortalException, SystemException {
247
248 return getUsersAdmin().getUserGroups(hits);
249 }
250
251 public static OrderByComparator getUserOrderByComparator(
252 String orderByCol, String orderByType) {
253
254 return getUsersAdmin().getUserOrderByComparator(
255 orderByCol, orderByType);
256 }
257
258 public static Tuple getUsers(Hits hits)
259 throws PortalException, SystemException {
260
261 return getUsersAdmin().getUsers(hits);
262 }
263
264 public static UsersAdmin getUsersAdmin() {
265 PortalRuntimePermission.checkGetBeanProperty(UsersAdminUtil.class);
266
267 return _usersAdmin;
268 }
269
270 public static List<Website> getWebsites(ActionRequest actionRequest) {
271 return getUsersAdmin().getWebsites(actionRequest);
272 }
273
274 public static List<Website> getWebsites(
275 ActionRequest actionRequest, List<Website> defaultWebsites) {
276
277 return getUsersAdmin().getWebsites(actionRequest, defaultWebsites);
278 }
279
280
285 public static boolean hasUpdateEmailAddress(
286 PermissionChecker permissionChecker, User user)
287 throws PortalException, SystemException {
288
289 return getUsersAdmin().hasUpdateEmailAddress(permissionChecker, user);
290 }
291
292 public static boolean hasUpdateFieldPermission(
293 PermissionChecker permissionChecker, User updatingUser,
294 User updatedUser, String field)
295 throws PortalException, SystemException {
296
297 return getUsersAdmin().hasUpdateFieldPermission(
298 permissionChecker, updatingUser, updatedUser, field);
299 }
300
301
306 @Deprecated
307 public static boolean hasUpdateFieldPermission(User user, String field)
308 throws PortalException, SystemException {
309
310 return getUsersAdmin().hasUpdateFieldPermission(user, field);
311 }
312
313
318 public static boolean hasUpdateScreenName(
319 PermissionChecker permissionChecker, User user)
320 throws PortalException, SystemException {
321
322 return getUsersAdmin().hasUpdateScreenName(permissionChecker, user);
323 }
324
325 public static long[] removeRequiredRoles(long userId, long[] roleIds)
326 throws PortalException, SystemException {
327
328 return getUsersAdmin().removeRequiredRoles(userId, roleIds);
329 }
330
331 public static long[] removeRequiredRoles(User user, long[] roleIds)
332 throws PortalException, SystemException {
333
334 return getUsersAdmin().removeRequiredRoles(user, roleIds);
335 }
336
337 public static void updateAddresses(
338 String className, long classPK, List<Address> addresses)
339 throws PortalException, SystemException {
340
341 getUsersAdmin().updateAddresses(className, classPK, addresses);
342 }
343
344 public static void updateEmailAddresses(
345 String className, long classPK, List<EmailAddress> emailAddresses)
346 throws PortalException, SystemException {
347
348 getUsersAdmin().updateEmailAddresses(
349 className, classPK, emailAddresses);
350 }
351
352 public static void updateOrgLabors(long classPK, List<OrgLabor> orgLabors)
353 throws PortalException, SystemException {
354
355 getUsersAdmin().updateOrgLabors(classPK, orgLabors);
356 }
357
358 public static void updatePhones(
359 String className, long classPK, List<Phone> phones)
360 throws PortalException, SystemException {
361
362 getUsersAdmin().updatePhones(className, classPK, phones);
363 }
364
365 public static void updateWebsites(
366 String className, long classPK, List<Website> websites)
367 throws PortalException, SystemException {
368
369 getUsersAdmin().updateWebsites(className, classPK, websites);
370 }
371
372 public void setUsersAdmin(UsersAdmin usersAdmin) {
373 PortalRuntimePermission.checkSetBeanProperty(getClass());
374
375 _usersAdmin = usersAdmin;
376 }
377
378 private static UsersAdmin _usersAdmin;
379
380 }