Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WikiUserManager | 34 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.wiki.user; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.model.reference.DocumentReference; | |
26 | ||
27 | /** | |
28 | * Component that manage how users can participate on a wiki (local users, members, invitation, etc...). | |
29 | * | |
30 | * @since 5.3M2 | |
31 | * @version $Id: 69dd1333be8341397f4cbde65833722f1c338de2 $ | |
32 | */ | |
33 | @Role | |
34 | public interface WikiUserManager | |
35 | { | |
36 | /** | |
37 | * @param wikiId Id of the wiki to test | |
38 | * @return the user scope of the wiki | |
39 | * @throws WikiUserManagerException if problems occur | |
40 | */ | |
41 | UserScope getUserScope(String wikiId) throws WikiUserManagerException; | |
42 | ||
43 | /** | |
44 | * Set the user scope of the wiki. | |
45 | * | |
46 | * @param wikiId Id of the wiki to change | |
47 | * @param scope the scope to set | |
48 | * @throws WikiUserManagerException if problems occur | |
49 | */ | |
50 | void setUserScope(String wikiId, UserScope scope) throws WikiUserManagerException; | |
51 | ||
52 | /** | |
53 | * @param wikiId if of the wiki to test | |
54 | * @return the membership type of the specified wiki | |
55 | * @throws WikiUserManagerException if problems occur | |
56 | */ | |
57 | MembershipType getMembershipType(String wikiId) throws WikiUserManagerException; | |
58 | ||
59 | /** | |
60 | * Set the membership type of the wiki and save the configuration. | |
61 | * | |
62 | * @param wikiId Id of the wiki to change | |
63 | * @param type the membershyp type to set | |
64 | * @throws WikiUserManagerException if problems occur | |
65 | */ | |
66 | void setMembershipType(String wikiId, MembershipType type) throws WikiUserManagerException; | |
67 | ||
68 | /** | |
69 | * @param wikiId id of the wiki | |
70 | * @return the list of all the local users | |
71 | * @throws WikiUserManagerException if problems occur | |
72 | */ | |
73 | Collection<String> getLocalUsers(String wikiId) throws WikiUserManagerException; | |
74 | ||
75 | /** | |
76 | * @param wikiId if the the wiki | |
77 | * @return the list of all the members (global users). | |
78 | * @throws WikiUserManagerException if problems occur | |
79 | */ | |
80 | Collection<String> getMembers(String wikiId) throws WikiUserManagerException; | |
81 | ||
82 | /** | |
83 | * To know if a user is a member of a wiki. | |
84 | * | |
85 | * @param userId Id of the user | |
86 | * @param wikiId Id of the wiki | |
87 | * @return if the user is a member of the specified wiki | |
88 | * @throws WikiUserManagerException if problems occur | |
89 | */ | |
90 | boolean isMember(String userId, String wikiId) throws WikiUserManagerException; | |
91 | ||
92 | /** | |
93 | * Add a user as a member. | |
94 | * | |
95 | * @param userId UserID to add | |
96 | * @param wikiId Id of the wiki | |
97 | * @throws WikiUserManagerException if problems occur | |
98 | */ | |
99 | void addMember(String userId, String wikiId) throws WikiUserManagerException; | |
100 | ||
101 | /** | |
102 | * Add a list of users as a member. | |
103 | * | |
104 | * @param userIds List of userID to add | |
105 | * @param wikiId Id of the wiki | |
106 | * @throws WikiUserManagerException if problems occur | |
107 | */ | |
108 | void addMembers(Collection<String> userIds, String wikiId) throws WikiUserManagerException; | |
109 | ||
110 | /** | |
111 | * Remove a member. | |
112 | * | |
113 | * @param userId UserID to remove | |
114 | * @param wikiId Id the the wiki | |
115 | * @throws WikiUserManagerException if problems occur | |
116 | */ | |
117 | void removeMember(String userId, String wikiId) throws WikiUserManagerException; | |
118 | ||
119 | /** | |
120 | * Remove a list of members. | |
121 | * | |
122 | * @param userIds List of UserID to remove | |
123 | * @param wikiId Id the the wiki | |
124 | * @throws WikiUserManagerException if problems occur | |
125 | */ | |
126 | void removeMembers(Collection<String> userIds, String wikiId) throws WikiUserManagerException; | |
127 | ||
128 | /** | |
129 | * Get all the invitations to join a wiki. | |
130 | * | |
131 | * @param wikiId id of the wiki to join | |
132 | * @return a list of invitations to join this wiki | |
133 | * @throws WikiUserManagerException if problems occur | |
134 | */ | |
135 | Collection<MemberCandidacy> getAllInvitations(String wikiId) throws WikiUserManagerException; | |
136 | ||
137 | /** | |
138 | * Get all the join requests for a wiki. | |
139 | * | |
140 | * @param wikiId id of the wiki to join | |
141 | * @return a list of join request for this wiki | |
142 | * @throws WikiUserManagerException if problems occur | |
143 | */ | |
144 | Collection<MemberCandidacy> getAllRequests(String wikiId) throws WikiUserManagerException; | |
145 | ||
146 | /** | |
147 | * @param user DocumentReference to the user to test | |
148 | * @param wikiId id of the wiki to test | |
149 | * @return either or not the user has a pending invitation to join the wiki | |
150 | * @throws WikiUserManagerException if problems occur | |
151 | */ | |
152 | boolean hasPendingInvitation(DocumentReference user, String wikiId) throws WikiUserManagerException; | |
153 | ||
154 | /** | |
155 | * @param user DocumentReference to the user to test | |
156 | * @param wikiId id of the wiki to test | |
157 | * @return either or not the user has a pending request to join the wiki | |
158 | * @throws WikiUserManagerException if problems occur | |
159 | */ | |
160 | boolean hasPendingRequest(DocumentReference user, String wikiId) throws WikiUserManagerException; | |
161 | ||
162 | /** | |
163 | * Get the specified member candidacy. | |
164 | * | |
165 | * @param wikiId Od of the request concerned by the candidacy | |
166 | * @param candidacyId Id of the candidacy to get | |
167 | * @return the candidacy | |
168 | * @throws WikiUserManagerException if problems occur | |
169 | */ | |
170 | MemberCandidacy getCandidacy(String wikiId, int candidacyId) throws WikiUserManagerException; | |
171 | ||
172 | /** | |
173 | * Perform a request to join a wiki. | |
174 | * | |
175 | * @param userId UserID of the requester | |
176 | * @param wikiId Id of the wiki to join | |
177 | * @param message Message that motivates the request | |
178 | * @return the generated candidacy | |
179 | * @throws WikiUserManagerException if problems occur | |
180 | */ | |
181 | MemberCandidacy askToJoin(String userId, String wikiId, String message) throws WikiUserManagerException; | |
182 | ||
183 | /** | |
184 | * Join a wiki. | |
185 | * | |
186 | * @param userId userId to add to the wiki | |
187 | * @param wikiId id of the wiki | |
188 | * @throws WikiUserManagerException if problems occur | |
189 | */ | |
190 | void join(String userId, String wikiId) throws WikiUserManagerException; | |
191 | ||
192 | /** | |
193 | * Leave a wiki. | |
194 | * | |
195 | * @param userId userId to remove from the wiki | |
196 | * @param wikiId id of the wiki | |
197 | * @throws WikiUserManagerException if problems occur | |
198 | */ | |
199 | void leave(String userId, String wikiId) throws WikiUserManagerException; | |
200 | ||
201 | /** | |
202 | * Accept the request to join the wiki. | |
203 | * | |
204 | * @param request request to accept | |
205 | * @param message message about the acceptance | |
206 | * @param privateComment private comment that only the administrator can see | |
207 | * @throws WikiUserManagerException if problems occur | |
208 | */ | |
209 | void acceptRequest(MemberCandidacy request, String message, String privateComment) | |
210 | throws WikiUserManagerException; | |
211 | ||
212 | /** | |
213 | * Refuse the request to join the wiki. | |
214 | * | |
215 | * @param request request to refuse | |
216 | * @param message message about the refusal | |
217 | * @param privateComment private comment that only the administrator can see | |
218 | * @throws WikiUserManagerException if problems occur | |
219 | */ | |
220 | void refuseRequest(MemberCandidacy request, String message, String privateComment) | |
221 | throws WikiUserManagerException; | |
222 | ||
223 | /** | |
224 | * Invite a global user to a wiki. | |
225 | * | |
226 | * @param userId Id of the user to add | |
227 | * @param wikiId Id of the wiki to join | |
228 | * @param message MemberCandidacy message | |
229 | * @return The generated invitation | |
230 | * @throws WikiUserManagerException if problems occur | |
231 | */ | |
232 | MemberCandidacy invite(String userId, String wikiId, String message) throws WikiUserManagerException; | |
233 | ||
234 | /** | |
235 | * Accept the invitation to join a wiki. | |
236 | * | |
237 | * @param invitation invitation to accept | |
238 | * @param message message that goes along the acceptance | |
239 | * @throws WikiUserManagerException if problems occur | |
240 | */ | |
241 | void acceptInvitation(MemberCandidacy invitation, String message) throws WikiUserManagerException; | |
242 | ||
243 | /** | |
244 | * Refuse the invitation to join a wiki. | |
245 | * | |
246 | * @param invitation invitation to refuse | |
247 | * @param message message that goes along the refusal | |
248 | * @throws WikiUserManagerException if problems occur | |
249 | */ | |
250 | void refuseInvitation(MemberCandidacy invitation, String message) throws WikiUserManagerException; | |
251 | ||
252 | /** | |
253 | * Cancel a candidacy. | |
254 | * | |
255 | * @param candidacy Candidacy to cancel | |
256 | * @throws WikiUserManagerException if problems occur | |
257 | */ | |
258 | void cancelCandidacy(MemberCandidacy candidacy) throws WikiUserManagerException; | |
259 | } |