001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.util.OrderByComparator;
021    import com.liferay.portal.kernel.util.Tuple;
022    import com.liferay.portal.model.Address;
023    import com.liferay.portal.model.EmailAddress;
024    import com.liferay.portal.model.Group;
025    import com.liferay.portal.model.OrgLabor;
026    import com.liferay.portal.model.Organization;
027    import com.liferay.portal.model.Phone;
028    import com.liferay.portal.model.Role;
029    import com.liferay.portal.model.User;
030    import com.liferay.portal.model.UserGroup;
031    import com.liferay.portal.model.UserGroupRole;
032    import com.liferay.portal.model.Website;
033    import com.liferay.portal.security.permission.PermissionChecker;
034    
035    import java.util.List;
036    
037    import javax.portlet.ActionRequest;
038    import javax.portlet.PortletRequest;
039    import javax.portlet.RenderResponse;
040    
041    import javax.servlet.http.HttpServletRequest;
042    
043    /**
044     * @author Brian Wing Shun Chan
045     * @author Jorge Ferrer
046     * @author Julio Camarero
047     */
048    public interface UsersAdmin {
049    
050            public static final String CUSTOM_QUESTION = "write-my-own-question";
051    
052            public void addPortletBreadcrumbEntries(
053                            Organization organization, HttpServletRequest request,
054                            RenderResponse renderResponse)
055                    throws Exception;
056    
057            public long[] addRequiredRoles(long userId, long[] roleIds)
058                    throws PortalException, SystemException;
059    
060            public long[] addRequiredRoles(User user, long[] roleIds)
061                    throws PortalException, SystemException;
062    
063            public List<Role> filterGroupRoles(
064                            PermissionChecker permissionChecker, long groupId, List<Role> roles)
065                    throws PortalException, SystemException;
066    
067            public List<Group> filterGroups(
068                            PermissionChecker permissionChecker, List<Group> groups)
069                    throws PortalException, SystemException;
070    
071            public List<Organization> filterOrganizations(
072                            PermissionChecker permissionChecker,
073                            List<Organization> organizations)
074                    throws PortalException, SystemException;
075    
076            public List<Role> filterRoles(
077                    PermissionChecker permissionChecker, List<Role> roles);
078    
079            public long[] filterUnsetGroupUserIds(
080                            PermissionChecker permissionChecker, long groupId, long[] userIds)
081                    throws PortalException, SystemException;
082    
083            public long[] filterUnsetOrganizationUserIds(
084                            PermissionChecker permissionChecker, long organizationId,
085                            long[] userIds)
086                    throws PortalException, SystemException;
087    
088            public List<UserGroupRole> filterUserGroupRoles(
089                            PermissionChecker permissionChecker,
090                            List<UserGroupRole> userGroupRoles)
091                    throws PortalException, SystemException;
092    
093            public List<UserGroup> filterUserGroups(
094                    PermissionChecker permissionChecker, List<UserGroup> userGroups);
095    
096            public List<Address> getAddresses(ActionRequest actionRequest);
097    
098            public List<Address> getAddresses(
099                    ActionRequest actionRequest, List<Address> defaultAddresses);
100    
101            public List<EmailAddress> getEmailAddresses(ActionRequest actionRequest);
102    
103            public List<EmailAddress> getEmailAddresses(
104                    ActionRequest actionRequest, List<EmailAddress> defaultEmailAddresses);
105    
106            public long[] getGroupIds(PortletRequest portletRequest)
107                    throws PortalException, SystemException;
108    
109            public OrderByComparator getGroupOrderByComparator(
110                    String orderByCol, String orderByType);
111    
112            public Long[] getOrganizationIds(List<Organization> organizations);
113    
114            public long[] getOrganizationIds(PortletRequest portletRequest)
115                    throws PortalException, SystemException;
116    
117            public OrderByComparator getOrganizationOrderByComparator(
118                    String orderByCol, String orderByType);
119    
120            public Tuple getOrganizations(Hits hits)
121                    throws PortalException, SystemException;
122    
123            public List<OrgLabor> getOrgLabors(ActionRequest actionRequest);
124    
125            public List<Phone> getPhones(ActionRequest actionRequest);
126    
127            public List<Phone> getPhones(
128                    ActionRequest actionRequest, List<Phone> defaultPhones);
129    
130            public long[] getRoleIds(PortletRequest portletRequest)
131                    throws PortalException, SystemException;
132    
133            public OrderByComparator getRoleOrderByComparator(
134                    String orderByCol, String orderByType);
135    
136            public long[] getUserGroupIds(PortletRequest portletRequest)
137                    throws PortalException, SystemException;
138    
139            public OrderByComparator getUserGroupOrderByComparator(
140                    String orderByCol, String orderByType);
141    
142            public List<UserGroupRole> getUserGroupRoles(PortletRequest portletRequest)
143                    throws PortalException, SystemException;
144    
145            public Tuple getUserGroups(Hits hits)
146                    throws PortalException, SystemException;
147    
148            public OrderByComparator getUserOrderByComparator(
149                    String orderByCol, String orderByType);
150    
151            public Tuple getUsers(Hits hits) throws PortalException, SystemException;
152    
153            public List<Website> getWebsites(ActionRequest actionRequest);
154    
155            public List<Website> getWebsites(
156                    ActionRequest actionRequest, List<Website> defaultWebsites);
157    
158            /**
159             * @deprecated As of 6.2.0, replaced by {@link
160             *             #hasUpdateFieldPermission(PermissionChecker, User, User,
161             *             String)}
162             */
163            public boolean hasUpdateEmailAddress(
164                            PermissionChecker permissionChecker, User user)
165                    throws PortalException, SystemException;
166    
167            public boolean hasUpdateFieldPermission(
168                            PermissionChecker permissionChecker, User updatingUser,
169                            User updatedUser, String field)
170                    throws PortalException, SystemException;
171    
172            /**
173             * @deprecated As of 6.2.0, replaced by {@link
174             *             #hasUpdateFieldPermission(PermissionChecker, User, User,
175             *             String)}
176             */
177            @Deprecated
178            public boolean hasUpdateFieldPermission(User user, String field)
179                    throws PortalException, SystemException;
180    
181            /**
182             * @deprecated As of 6.2.0, replaced by {@link
183             *             #hasUpdateFieldPermission(PermissionChecker, User, User,
184             *             String)}
185             */
186            public boolean hasUpdateScreenName(
187                            PermissionChecker permissionChecker, User user)
188                    throws PortalException, SystemException;
189    
190            public long[] removeRequiredRoles(long userId, long[] roleIds)
191                    throws PortalException, SystemException;
192    
193            public long[] removeRequiredRoles(User user, long[] roleIds)
194                    throws PortalException, SystemException;
195    
196            public void updateAddresses(
197                            String className, long classPK, List<Address> addresses)
198                    throws PortalException, SystemException;
199    
200            public void updateEmailAddresses(
201                            String className, long classPK, List<EmailAddress> emailAddresses)
202                    throws PortalException, SystemException;
203    
204            public void updateOrgLabors(long classPK, List<OrgLabor> orgLabors)
205                    throws PortalException, SystemException;
206    
207            public void updatePhones(String className, long classPK, List<Phone> phones)
208                    throws PortalException, SystemException;
209    
210            public void updateWebsites(
211                            String className, long classPK, List<Website> websites)
212                    throws PortalException, SystemException;
213    
214    }