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 List<UserGroupRole> filterUserGroupRoles(
080                            PermissionChecker permissionChecker,
081                            List<UserGroupRole> userGroupRoles)
082                    throws PortalException, SystemException;
083    
084            public List<UserGroup> filterUserGroups(
085                    PermissionChecker permissionChecker, List<UserGroup> userGroups);
086    
087            public List<Address> getAddresses(ActionRequest actionRequest);
088    
089            public List<Address> getAddresses(
090                    ActionRequest actionRequest, List<Address> defaultAddresses);
091    
092            public List<EmailAddress> getEmailAddresses(ActionRequest actionRequest);
093    
094            public List<EmailAddress> getEmailAddresses(
095                    ActionRequest actionRequest, List<EmailAddress> defaultEmailAddresses);
096    
097            public OrderByComparator getGroupOrderByComparator(
098                    String orderByCol, String orderByType);
099    
100            public Long[] getOrganizationIds(List<Organization> organizations);
101    
102            public OrderByComparator getOrganizationOrderByComparator(
103                    String orderByCol, String orderByType);
104    
105            public Tuple getOrganizations(Hits hits)
106                    throws PortalException, SystemException;
107    
108            public List<OrgLabor> getOrgLabors(ActionRequest actionRequest);
109    
110            public List<Phone> getPhones(ActionRequest actionRequest);
111    
112            public List<Phone> getPhones(
113                    ActionRequest actionRequest, List<Phone> defaultPhones);
114    
115            public OrderByComparator getRoleOrderByComparator(
116                    String orderByCol, String orderByType);
117    
118            public OrderByComparator getUserGroupOrderByComparator(
119                    String orderByCol, String orderByType);
120    
121            public List<UserGroupRole> getUserGroupRoles(PortletRequest portletRequest)
122                    throws PortalException, SystemException;
123    
124            public OrderByComparator getUserOrderByComparator(
125                    String orderByCol, String orderByType);
126    
127            public Tuple getUsers(Hits hits) throws PortalException, SystemException;
128    
129            public List<Website> getWebsites(ActionRequest actionRequest);
130    
131            public List<Website> getWebsites(
132                    ActionRequest actionRequest, List<Website> defaultWebsites);
133    
134            public boolean hasUpdateEmailAddress(
135                            PermissionChecker permissionChecker, User user)
136                    throws PortalException, SystemException;
137    
138            public boolean hasUpdateScreenName(
139                            PermissionChecker permissionChecker, User user)
140                    throws PortalException, SystemException;
141    
142            public long[] removeRequiredRoles(long userId, long[] roleIds)
143                    throws PortalException, SystemException;
144    
145            public long[] removeRequiredRoles(User user, long[] roleIds)
146                    throws PortalException, SystemException;
147    
148            public void updateAddresses(
149                            String className, long classPK, List<Address> addresses)
150                    throws PortalException, SystemException;
151    
152            public void updateEmailAddresses(
153                            String className, long classPK, List<EmailAddress> emailAddresses)
154                    throws PortalException, SystemException;
155    
156            public void updateOrgLabors(long classPK, List<OrgLabor> orgLabors)
157                    throws PortalException, SystemException;
158    
159            public void updatePhones(String className, long classPK, List<Phone> phones)
160                    throws PortalException, SystemException;
161    
162            public void updateWebsites(
163                            String className, long classPK, List<Website> websites)
164                    throws PortalException, SystemException;
165    
166    }