1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.wiki.user.script; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.Collection; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Provider; |
28 |
|
import javax.inject.Singleton; |
29 |
|
|
30 |
|
import org.xwiki.component.annotation.Component; |
31 |
|
import org.xwiki.context.Execution; |
32 |
|
import org.xwiki.model.reference.DocumentReference; |
33 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
34 |
|
import org.xwiki.model.reference.WikiReference; |
35 |
|
import org.xwiki.script.service.ScriptService; |
36 |
|
import org.xwiki.security.authorization.AccessDeniedException; |
37 |
|
import org.xwiki.security.authorization.AuthorizationManager; |
38 |
|
import org.xwiki.security.authorization.Right; |
39 |
|
import org.xwiki.wiki.descriptor.WikiDescriptorManager; |
40 |
|
import org.xwiki.wiki.user.MemberCandidacy; |
41 |
|
import org.xwiki.wiki.user.MembershipType; |
42 |
|
import org.xwiki.wiki.user.UserScope; |
43 |
|
import org.xwiki.wiki.user.WikiUserManager; |
44 |
|
import org.xwiki.wiki.user.WikiUserManagerException; |
45 |
|
|
46 |
|
import com.xpn.xwiki.XWikiContext; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@since |
52 |
|
@version |
53 |
|
|
54 |
|
@Component |
55 |
|
@Named("wiki.user") |
56 |
|
@Singleton |
|
|
| 97.6% |
Uncovered Elements: 5 (208) |
Complexity: 64 |
Complexity Density: 0.4 |
|
57 |
|
public class WikiUserManagerScriptService implements ScriptService |
58 |
|
{ |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
private static final String WIKIUSERERROR_KEY = "scriptservice.wiki.user.error"; |
63 |
|
|
64 |
|
@Inject |
65 |
|
private WikiUserManager wikiUserManager; |
66 |
|
|
67 |
|
@Inject |
68 |
|
private WikiDescriptorManager wikiDescriptorManager; |
69 |
|
|
70 |
|
@Inject |
71 |
|
private AuthorizationManager authorizationManager; |
72 |
|
|
73 |
|
@Inject |
74 |
|
private Provider<XWikiContext> xcontextProvider; |
75 |
|
|
76 |
|
@Inject |
77 |
|
private DocumentReferenceResolver<String> documentReferenceResolver; |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@Inject |
83 |
|
private Execution execution; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@return |
89 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
50 |
public Exception getLastError()... |
91 |
|
{ |
92 |
50 |
return (Exception) this.execution.getContext().getProperty(WIKIUSERERROR_KEY); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
@link |
97 |
|
|
98 |
|
@param |
99 |
|
@see |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
38 |
private void setLastError(Exception e)... |
102 |
|
{ |
103 |
38 |
this.execution.getContext().setProperty(WIKIUSERERROR_KEY, e); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
25 |
public UserScope getUserScope()... |
110 |
|
{ |
111 |
25 |
return getUserScope(wikiDescriptorManager.getCurrentWikiId()); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
@return |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
118 |
62 |
public UserScope getUserScope(String wikiId)... |
119 |
|
{ |
120 |
62 |
try { |
121 |
62 |
return wikiUserManager.getUserScope(wikiId); |
122 |
|
} catch (WikiUserManagerException e) { |
123 |
1 |
setLastError(e); |
124 |
1 |
return null; |
125 |
|
} |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
@param |
132 |
|
|
133 |
|
@throws |
134 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
135 |
21 |
private void checkRights(String wikiId) throws AccessDeniedException... |
136 |
|
{ |
137 |
21 |
checkRights(wikiId, null); |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
@param |
144 |
|
@param |
145 |
|
|
146 |
|
@throws |
147 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
148 |
48 |
private void checkRights(String wikiId, DocumentReference user) throws AccessDeniedException... |
149 |
|
{ |
150 |
48 |
XWikiContext context = xcontextProvider.get(); |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
48 |
authorizationManager.checkAccess(Right.ADMIN, context.getDoc().getAuthorReference(), |
160 |
|
context.getDoc().getDocumentReference()); |
161 |
|
|
162 |
|
|
163 |
40 |
if (user != null && user.equals(context.getUserReference())) { |
164 |
|
|
165 |
18 |
return; |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
22 |
authorizationManager.checkAccess(Right.ADMIN, context.getUserReference(), new WikiReference(wikiId)); |
170 |
|
} |
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
@param |
176 |
|
|
177 |
|
@throws |
178 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
15 |
private void checkRights(MemberCandidacy candidacy) throws AccessDeniedException... |
180 |
|
{ |
181 |
15 |
checkRights(candidacy.getWikiId(), documentReferenceResolver.resolve(candidacy.getUserId())); |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
@param |
187 |
|
@param |
188 |
|
@return |
189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
190 |
6 |
public boolean setUserScope(String wikiId, String scope)... |
191 |
|
{ |
192 |
6 |
try { |
193 |
6 |
checkRights(wikiId); |
194 |
4 |
wikiUserManager.setUserScope(wikiId, UserScope.valueOf(scope.toUpperCase())); |
195 |
|
} catch (WikiUserManagerException | AccessDeniedException | IllegalArgumentException e) { |
196 |
4 |
setLastError(e); |
197 |
4 |
return false; |
198 |
|
} |
199 |
|
|
200 |
2 |
return true; |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
|
@return |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
1 |
public MembershipType getMembershipType()... |
207 |
|
{ |
208 |
1 |
return getMembershipType(wikiDescriptorManager.getCurrentWikiId()); |
209 |
|
} |
210 |
|
|
211 |
|
|
212 |
|
@param |
213 |
|
@return |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
215 |
26 |
public MembershipType getMembershipType(String wikiId)... |
216 |
|
{ |
217 |
26 |
try { |
218 |
26 |
return wikiUserManager.getMembershipType(wikiId); |
219 |
|
} catch (WikiUserManagerException e) { |
220 |
1 |
setLastError(e); |
221 |
1 |
return null; |
222 |
|
} |
223 |
|
} |
224 |
|
|
225 |
|
|
226 |
|
@param |
227 |
|
@param |
228 |
|
@return |
229 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
230 |
4 |
public boolean setMembershipType(String wikiId, String type)... |
231 |
|
{ |
232 |
4 |
try { |
233 |
4 |
checkRights(wikiId); |
234 |
2 |
wikiUserManager.setMembershipType(wikiId, MembershipType.valueOf(type.toUpperCase())); |
235 |
|
} catch (WikiUserManagerException | AccessDeniedException | IllegalArgumentException e) { |
236 |
4 |
setLastError(e); |
237 |
4 |
return false; |
238 |
|
} |
239 |
|
|
240 |
0 |
return true; |
241 |
|
} |
242 |
|
|
243 |
|
|
244 |
|
@param |
245 |
|
@return |
246 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
247 |
2 |
public Collection<String> getMembers(String wikiId)... |
248 |
|
{ |
249 |
2 |
try { |
250 |
2 |
return wikiUserManager.getMembers(wikiId); |
251 |
|
} catch (WikiUserManagerException e) { |
252 |
1 |
setLastError(e); |
253 |
1 |
return null; |
254 |
|
} |
255 |
|
} |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
@param |
261 |
|
@param |
262 |
|
@return |
263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
264 |
27 |
public Boolean isMember(String userId, String wikiId)... |
265 |
|
{ |
266 |
27 |
try { |
267 |
27 |
return wikiUserManager.isMember(userId, wikiId); |
268 |
|
} catch (WikiUserManagerException e) { |
269 |
1 |
setLastError(e); |
270 |
1 |
return null; |
271 |
|
} |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
@param |
278 |
|
@param |
279 |
|
@return |
280 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
281 |
3 |
public boolean addMember(String userId, String wikiId)... |
282 |
|
{ |
283 |
3 |
try { |
284 |
3 |
checkRights(wikiId); |
285 |
1 |
wikiUserManager.addMember(userId, wikiId); |
286 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
287 |
2 |
setLastError(e); |
288 |
2 |
return false; |
289 |
|
} |
290 |
|
|
291 |
1 |
return true; |
292 |
|
} |
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
@param |
298 |
|
@param |
299 |
|
@return |
300 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
301 |
3 |
public boolean addMembers(Collection<String> userIds, String wikiId)... |
302 |
|
{ |
303 |
3 |
try { |
304 |
3 |
checkRights(wikiId); |
305 |
1 |
wikiUserManager.addMembers(userIds, wikiId); |
306 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
307 |
2 |
setLastError(e); |
308 |
2 |
return false; |
309 |
|
} |
310 |
|
|
311 |
1 |
return true; |
312 |
|
} |
313 |
|
|
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
@param |
318 |
|
@param |
319 |
|
@return |
320 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
321 |
3 |
public boolean removeMember(String userId, String wikiId)... |
322 |
|
{ |
323 |
3 |
try { |
324 |
3 |
checkRights(wikiId); |
325 |
1 |
wikiUserManager.removeMember(userId, wikiId); |
326 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
327 |
2 |
setLastError(e); |
328 |
2 |
return false; |
329 |
|
} |
330 |
|
|
331 |
1 |
return true; |
332 |
|
} |
333 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
334 |
7 |
private boolean canSeeCandidacy(MemberCandidacy candidacy)... |
335 |
|
{ |
336 |
7 |
XWikiContext context = xcontextProvider.get(); |
337 |
|
|
338 |
|
|
339 |
7 |
DocumentReference candidacyUser = documentReferenceResolver.resolve(candidacy.getUserId()); |
340 |
7 |
if (context.getUserReference().equals(candidacyUser)) { |
341 |
|
|
342 |
3 |
candidacy.setAdminPrivateComment(null); |
343 |
3 |
return true; |
344 |
|
} |
345 |
|
|
346 |
|
|
347 |
4 |
return authorizationManager.hasAccess(Right.ADMIN, context.getUserReference(), |
348 |
|
new WikiReference(candidacy.getWikiId())); |
349 |
|
} |
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
@param |
355 |
|
@param |
356 |
|
@return |
357 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
358 |
4 |
public MemberCandidacy getCandidacy(String wikiId, int candidacyId)... |
359 |
|
{ |
360 |
|
|
361 |
4 |
MemberCandidacy candidacy = null; |
362 |
4 |
try { |
363 |
4 |
candidacy = wikiUserManager.getCandidacy(wikiId, candidacyId); |
364 |
|
|
365 |
3 |
if (!canSeeCandidacy(candidacy)) { |
366 |
1 |
setLastError(new WikiUserManagerScriptServiceException("You are not allowed to see this candidacy.")); |
367 |
1 |
candidacy = null; |
368 |
|
} |
369 |
|
} catch (WikiUserManagerException e) { |
370 |
1 |
setLastError(e); |
371 |
|
} |
372 |
|
|
373 |
4 |
return candidacy; |
374 |
|
} |
375 |
|
|
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
@param |
380 |
|
@return |
381 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
382 |
2 |
private Collection<MemberCandidacy> filterAuthorizedCandidacies(Collection<MemberCandidacy> candidacies)... |
383 |
|
{ |
384 |
2 |
Collection<MemberCandidacy> authorizedCandidacies = new ArrayList<MemberCandidacy>(); |
385 |
|
|
386 |
2 |
for (MemberCandidacy candidacy : candidacies) { |
387 |
4 |
if (canSeeCandidacy(candidacy)) { |
388 |
2 |
authorizedCandidacies.add(candidacy); |
389 |
|
} |
390 |
|
} |
391 |
|
|
392 |
2 |
return authorizedCandidacies; |
393 |
|
} |
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
398 |
|
@param |
399 |
|
@return |
400 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
401 |
2 |
public Collection<MemberCandidacy> getAllInvitations(String wikiId)... |
402 |
|
{ |
403 |
2 |
try { |
404 |
2 |
Collection<MemberCandidacy> candidacies = wikiUserManager.getAllInvitations(wikiId); |
405 |
1 |
return filterAuthorizedCandidacies(candidacies); |
406 |
|
} catch (WikiUserManagerException e) { |
407 |
1 |
setLastError(e); |
408 |
1 |
return null; |
409 |
|
} |
410 |
|
} |
411 |
|
|
412 |
|
|
413 |
|
@param |
414 |
|
@param |
415 |
|
@return |
416 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
417 |
4 |
public Boolean hasPendingInvitation(DocumentReference user, String wikiId)... |
418 |
|
{ |
419 |
|
|
420 |
4 |
if (user == null) { |
421 |
0 |
return false; |
422 |
|
} |
423 |
|
|
424 |
4 |
try { |
425 |
4 |
checkRights(wikiId, user); |
426 |
3 |
return wikiUserManager.hasPendingInvitation(user, wikiId); |
427 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
428 |
2 |
setLastError(e); |
429 |
|
} |
430 |
|
|
431 |
2 |
return null; |
432 |
|
} |
433 |
|
|
434 |
|
|
435 |
|
@param |
436 |
|
@param |
437 |
|
@return |
438 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
439 |
4 |
public Boolean hasPendingRequest(DocumentReference user, String wikiId)... |
440 |
|
{ |
441 |
|
|
442 |
4 |
if (user == null) { |
443 |
0 |
return false; |
444 |
|
} |
445 |
|
|
446 |
4 |
try { |
447 |
4 |
checkRights(wikiId, user); |
448 |
3 |
return wikiUserManager.hasPendingRequest(user, wikiId); |
449 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
450 |
2 |
setLastError(e); |
451 |
|
} |
452 |
|
|
453 |
2 |
return null; |
454 |
|
} |
455 |
|
|
456 |
|
|
457 |
|
|
458 |
|
|
459 |
|
@param |
460 |
|
@return |
461 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
462 |
2 |
public Collection<MemberCandidacy> getAllRequests(String wikiId)... |
463 |
|
{ |
464 |
2 |
try { |
465 |
2 |
Collection<MemberCandidacy> candidacies = wikiUserManager.getAllRequests(wikiId); |
466 |
1 |
return filterAuthorizedCandidacies(candidacies); |
467 |
|
} catch (WikiUserManagerException e) { |
468 |
1 |
setLastError(e); |
469 |
1 |
return null; |
470 |
|
} |
471 |
|
} |
472 |
|
|
473 |
|
|
474 |
|
|
475 |
|
|
476 |
|
@param |
477 |
|
@param |
478 |
|
@return |
479 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
480 |
3 |
public boolean join(String userId, String wikiId)... |
481 |
|
{ |
482 |
|
|
483 |
3 |
XWikiContext context = xcontextProvider.get(); |
484 |
3 |
DocumentReference candidacyUser = documentReferenceResolver.resolve(userId); |
485 |
3 |
if (!context.getUserReference().equals(candidacyUser)) { |
486 |
1 |
setLastError(new WikiUserManagerException(String.format("User [%s] cannot call " |
487 |
|
+ "$services.wiki.user.join() with an other userId.", context.getUserReference()))); |
488 |
1 |
return false; |
489 |
|
} |
490 |
|
|
491 |
2 |
try { |
492 |
2 |
wikiUserManager.join(userId, wikiId); |
493 |
|
} catch (WikiUserManagerException e) { |
494 |
1 |
setLastError(e); |
495 |
1 |
return false; |
496 |
|
} |
497 |
1 |
return true; |
498 |
|
} |
499 |
|
|
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
@param |
504 |
|
@param |
505 |
|
@return |
506 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
507 |
3 |
public boolean leave(String userId, String wikiId)... |
508 |
|
{ |
509 |
|
|
510 |
3 |
XWikiContext context = xcontextProvider.get(); |
511 |
3 |
DocumentReference candidacyUser = documentReferenceResolver.resolve(userId); |
512 |
3 |
if (!context.getUserReference().equals(candidacyUser)) { |
513 |
1 |
setLastError(new WikiUserManagerException(String.format("User [%s] cannot call $services.wiki.user.leave()" |
514 |
|
+ " with an other userId.", context.getUserReference()))); |
515 |
1 |
return false; |
516 |
|
} |
517 |
|
|
518 |
|
|
519 |
2 |
try { |
520 |
2 |
wikiUserManager.leave(userId, wikiId); |
521 |
|
} catch (WikiUserManagerException e) { |
522 |
1 |
setLastError(e); |
523 |
1 |
return false; |
524 |
|
} |
525 |
|
|
526 |
1 |
return true; |
527 |
|
} |
528 |
|
|
529 |
|
|
530 |
|
|
531 |
|
|
532 |
|
@param |
533 |
|
@param |
534 |
|
@param |
535 |
|
@return |
536 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
537 |
4 |
public MemberCandidacy askToJoin(String userId, String wikiId, String message)... |
538 |
|
{ |
539 |
4 |
try { |
540 |
4 |
checkRights(wikiId, documentReferenceResolver.resolve(userId)); |
541 |
2 |
return wikiUserManager.askToJoin(userId, wikiId, message); |
542 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
543 |
2 |
setLastError(e); |
544 |
2 |
return null; |
545 |
|
} |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
@param |
552 |
|
@param |
553 |
|
@param |
554 |
|
@return |
555 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
556 |
3 |
public boolean acceptRequest(MemberCandidacy request, String message, String privateComment)... |
557 |
|
{ |
558 |
3 |
try { |
559 |
3 |
checkRights(request); |
560 |
2 |
wikiUserManager.acceptRequest(request, message, privateComment); |
561 |
2 |
return true; |
562 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
563 |
1 |
setLastError(e); |
564 |
|
} |
565 |
|
|
566 |
1 |
return false; |
567 |
|
} |
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
@param |
573 |
|
@param |
574 |
|
@param |
575 |
|
@return |
576 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
577 |
3 |
public boolean refuseRequest(MemberCandidacy request, String message, String privateComment)... |
578 |
|
{ |
579 |
3 |
try { |
580 |
3 |
checkRights(request); |
581 |
2 |
wikiUserManager.refuseRequest(request, message, privateComment); |
582 |
2 |
return true; |
583 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
584 |
1 |
setLastError(e); |
585 |
|
} |
586 |
|
|
587 |
1 |
return false; |
588 |
|
} |
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
@param |
594 |
|
@return |
595 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
596 |
3 |
public boolean cancelCandidacy(MemberCandidacy candidacy)... |
597 |
|
{ |
598 |
3 |
try { |
599 |
3 |
checkRights(candidacy); |
600 |
2 |
wikiUserManager.cancelCandidacy(candidacy); |
601 |
2 |
return true; |
602 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
603 |
1 |
setLastError(e); |
604 |
|
} |
605 |
|
|
606 |
1 |
return false; |
607 |
|
} |
608 |
|
|
609 |
|
|
610 |
|
|
611 |
|
|
612 |
|
@param |
613 |
|
@param |
614 |
|
@param |
615 |
|
@return |
616 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
617 |
2 |
public MemberCandidacy invite(String userId, String wikiId, String message)... |
618 |
|
{ |
619 |
2 |
try { |
620 |
2 |
checkRights(wikiId); |
621 |
1 |
return wikiUserManager.invite(userId, wikiId, message); |
622 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
623 |
1 |
setLastError(e); |
624 |
|
} |
625 |
|
|
626 |
1 |
return null; |
627 |
|
} |
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
@param |
633 |
|
@param |
634 |
|
@return |
635 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
636 |
3 |
public boolean acceptInvitation(MemberCandidacy invitation, String message)... |
637 |
|
{ |
638 |
3 |
try { |
639 |
3 |
checkRights(invitation); |
640 |
2 |
wikiUserManager.acceptInvitation(invitation, message); |
641 |
2 |
return true; |
642 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
643 |
1 |
setLastError(e); |
644 |
|
} |
645 |
|
|
646 |
1 |
return false; |
647 |
|
} |
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
@param |
653 |
|
@param |
654 |
|
@return |
655 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
656 |
3 |
public boolean refuseInvitation(MemberCandidacy invitation, String message)... |
657 |
|
{ |
658 |
3 |
try { |
659 |
3 |
checkRights(invitation); |
660 |
2 |
wikiUserManager.refuseInvitation(invitation, message); |
661 |
2 |
return true; |
662 |
|
} catch (AccessDeniedException | WikiUserManagerException e) { |
663 |
1 |
setLastError(e); |
664 |
|
} |
665 |
|
|
666 |
1 |
return false; |
667 |
|
} |
668 |
|
} |