Package org.xwiki.wiki.user.script
Class WikiUserManagerScriptService
java.lang.Object
org.xwiki.wiki.user.script.WikiUserManagerScriptService
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component
@Named("wiki.user")
@Singleton
public class WikiUserManagerScriptService
extends Object
implements org.xwiki.script.service.ScriptService
Script service to manage how the user are supported in a wiki.
- Since:
- 5.3M2
- Version:
- $Id: 2b2c5821d85a84a68db2397e6d9ed646f48a7919 $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptInvitation(MemberCandidacy invitation, String message) Accept the invitation to join a wiki.booleanacceptRequest(MemberCandidacy request, String message, String privateComment) Accept the request to join the wiki.booleanAdd a user as a member.booleanaddMembers(Collection<String> userIds, String wikiId) Add a list of users as a members.Perform a request to join a wiki.booleancancelCandidacy(MemberCandidacy candidacy) Cancel a candidacy.getAllInvitations(String wikiId) Get all the invitations to join a wiki.getAllRequests(String wikiId) Get all the join requests for a wiki that the current user has the right to see.getCandidacy(String wikiId, int candidacyId) Get the specified candidacy.Get the error generated while performing the previously called action.getMembers(String wikiId) getMembershipType(String wikiId) getUserScope(String wikiId) hasPendingInvitation(org.xwiki.model.reference.DocumentReference user, String wikiId) hasPendingRequest(org.xwiki.model.reference.DocumentReference user, String wikiId) Invite a global user to a wiki.To know if a user is a member of a wiki.booleanJoin a wiki.booleanLeave a wiki.booleanrefuseInvitation(MemberCandidacy invitation, String message) Refuse the invitation to join a wiki.booleanrefuseRequest(MemberCandidacy request, String message, String privateComment) Refuse the request to join the wiki.booleanremoveMember(String userId, String wikiId) Remove a member.booleansetMembershipType(String wikiId, String type) booleansetUserScope(String wikiId, String scope)
-
Constructor Details
-
WikiUserManagerScriptService
public WikiUserManagerScriptService()
-
-
Method Details
-
getLastError
Get the error generated while performing the previously called action.- Returns:
- an eventual exception or
nullif no exception was thrown
-
getUserScope
- Returns:
- the user scope
-
getUserScope
- Parameters:
wikiId- Id of the wiki to test- Returns:
- the user scope
-
setUserScope
- Parameters:
wikiId- Id of the wiki to changescope- scope to set- Returns:
- true if it succeed
-
getMembershipType
- Returns:
- the membership type of the current wiki
-
getMembershipType
- Parameters:
wikiId- Id of the wiki to test- Returns:
- the membership type of the specified wiki
-
setMembershipType
- Parameters:
wikiId- Id of the wiki to changetype- the membership type to set- Returns:
- true if it succeed
-
getMembers
- Parameters:
wikiId- if the the wiki- Returns:
- the list of all the members (global users) or null if something failed.
-
isMember
To know if a user is a member of a wiki.- Parameters:
userId- Id of the userwikiId- Id of the wiki- Returns:
- if the user is a member of the specified wiki or null if some problems occur
-
addMember
Add a user as a member.- Parameters:
userId- UserID to addwikiId- Id of the wiki- Returns:
- true if it succeed
-
addMembers
Add a list of users as a members.- Parameters:
userIds- List of userID to addwikiId- Id of the wiki- Returns:
- true if it succeed
-
removeMember
Remove a member.- Parameters:
userId- UserID to removewikiId- Id the the wiki- Returns:
- true if it succeed
-
getCandidacy
Get the specified candidacy.- Parameters:
wikiId- Id of the wiki concerned by the candidacycandidacyId- id of the candidacy- Returns:
- the candidacy or null if problems occur
-
getAllInvitations
Get all the invitations to join a wiki.- Parameters:
wikiId- id of the wiki to join- Returns:
- a list of invitations to join this wiki or null if some problems occur
-
hasPendingInvitation
public Boolean hasPendingInvitation(org.xwiki.model.reference.DocumentReference user, String wikiId) - Parameters:
user- DocumentReference to the user to testwikiId- id of the wiki to test- Returns:
- either or not the user has a pending invitation to join the wiki, null if some problems occur
-
hasPendingRequest
- Parameters:
user- DocumentReference to the user to testwikiId- id of the wiki to test- Returns:
- either or not the user has a pending request to join the wiki, null if some problems occur
-
getAllRequests
Get all the join requests for a wiki that the current user has the right to see.- Parameters:
wikiId- id of the wiki to join- Returns:
- a list of join request for this wiki or null if some problems occur
-
join
Join a wiki.- Parameters:
userId- userId to add to the wikiwikiId- id of the wiki- Returns:
- true if it succeed
-
leave
Leave a wiki.- Parameters:
userId- userId to remove from the wikiwikiId- id of the wiki- Returns:
- true if it succeed
-
askToJoin
Perform a request to join a wiki.- Parameters:
userId- UserID of the requesterwikiId- Id of the wiki to joinmessage- Message that motivates the request- Returns:
- the generated candidacy
-
acceptRequest
Accept the request to join the wiki.- Parameters:
request- request to acceptmessage- message about the acceptanceprivateComment- private comment that only the administrator can see- Returns:
- true if it succeed
-
refuseRequest
Refuse the request to join the wiki.- Parameters:
request- request to refusemessage- message about the refusalprivateComment- private comment that only the administrator can see- Returns:
- true if it succeed
-
cancelCandidacy
Cancel a candidacy.- Parameters:
candidacy- Candidacy to cancel- Returns:
- true if it succeed
-
invite
Invite a global user to a wiki.- Parameters:
userId- Id of the user to addwikiId- Id of the wiki to joinmessage- MemberCandidacy message- Returns:
- The generated invitation or null if problems occur
-
acceptInvitation
Accept the invitation to join a wiki.- Parameters:
invitation- invitation to acceptmessage- message that goes along the acceptance- Returns:
- true if it succeed
-
refuseInvitation
Refuse the invitation to join a wiki.- Parameters:
invitation- invitation to refusemessage- message that goes along the refusal- Returns:
- true if it succeed
-