public class XWikiGroupServiceImpl extends Object implements XWikiGroupService, org.xwiki.observation.EventListener
XWikiGroupService
users and groups manager.Modifier and Type | Field and Description |
---|---|
static EntityReference |
GROUPCLASS_REFERENCE |
Constructor and Description |
---|
XWikiGroupServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addUserToGroup(String username,
String database,
String group,
XWikiContext context)
Deprecated.
|
int |
countAllGroupsNamesForMember(String member,
XWikiContext context)
Return the number of groups containing provided member.
|
int |
countAllMatchedGroups(Object[][] matchFields,
XWikiContext context)
Return number of groups with provided constraints.
|
int |
countAllMatchedMembersNamesForGroup(String group,
String filter,
XWikiContext xcontext)
Filters the members of the specified group using the given text and counts the results.
|
int |
countAllMatchedUsers(Object[][] matchFields,
XWikiContext context)
Return number of users with provided constraints.
|
protected int |
countAllMatchedUsersOrGroups(boolean user,
Object[][] matchFields,
XWikiContext context)
Return number of users or groups with provided constraints.
|
int |
countAllMembersNamesForGroup(String group,
XWikiContext context)
Return the number of members provided group contains.
|
protected String |
createMatchGroupMembersWhereClause(String groupFullName,
String matchField,
Boolean orderAsc,
Map<String,Object> parameterValues)
Create a query to filter provided group members.
|
protected String |
createMatchUserOrGroupWhereClause(boolean user,
Object[][] matchFields,
Object[][] order,
List<Object> parameterValues)
Create a "where clause" to use with
XWikiStoreInterface searchDocuments and searchDocumentsNames methods. |
void |
flushCache() |
Collection<String> |
getAllGroupsNamesForMember(String member,
int nb,
int start,
XWikiContext context)
Get all groups containing provided member in the provided member wiki.
|
Collection<DocumentReference> |
getAllGroupsReferencesForMember(DocumentReference memberReference,
int limit,
int offset,
XWikiContext context)
Get all groups containing provided member in the current wiki.
|
List<?> |
getAllMatchedGroups(Object[][] matchFields,
boolean withdetails,
int nb,
int start,
Object[][] order,
XWikiContext context)
Search for all groups with provided constraints and in a provided order.
|
Collection<String> |
getAllMatchedMembersNamesForGroup(String group,
String matchField,
int nb,
int start,
Boolean orderAsc,
XWikiContext context)
Get members of provided group.
|
List<?> |
getAllMatchedUsers(Object[][] matchFields,
boolean withdetails,
int nb,
int start,
Object[][] order,
XWikiContext context)
Search for all users with provided constraints and in a provided order.
|
protected List<?> |
getAllMatchedUsersOrGroups(boolean user,
Object[][] matchFields,
boolean withdetails,
int nb,
int start,
Object[][] order,
XWikiContext context)
Search for all users or group with provided constraints and in a provided order.
|
Collection<String> |
getAllMembersNamesForGroup(String group,
int nb,
int start,
XWikiContext context)
Get all members provided group contains.
|
List<org.xwiki.observation.event.Event> |
getEvents() |
String |
getName() |
void |
init(XWiki xwiki,
XWikiContext context) |
void |
initCache(int iCapacity,
XWikiContext context) |
void |
initCache(XWikiContext context) |
protected boolean |
isAllGroupImplicit(XWikiContext context)
Check whether the configuration specifies that every user is implicitly in XWikiAllGroup.
|
List<String> |
listAllGroups(XWikiContext context)
Deprecated.
|
Collection<String> |
listGroupsForUser(String member,
XWikiContext context)
Deprecated.
|
List<String> |
listMemberForGroup(String group,
XWikiContext context)
Deprecated.
|
void |
onEvent(org.xwiki.observation.event.Event event,
Object source,
Object data) |
void |
removeUserOrGroupFromAllGroups(String memberWiki,
String memberSpace,
String memberName,
XWikiContext context)
Remove user or group name from all groups.
|
void |
replaceMemberInAllGroups(DocumentReference memberSourceReference,
DocumentReference memberTargetReference,
XWikiContext context)
Replace a given member reference by another one in all groups of the wiki.
|
public static final EntityReference GROUPCLASS_REFERENCE
public void init(XWiki xwiki, XWikiContext context) throws XWikiException
init
in interface XWikiGroupService
XWikiException
public void initCache(XWikiContext context) throws XWikiException
initCache
in interface XWikiGroupService
XWikiException
public void initCache(int iCapacity, XWikiContext context) throws XWikiException
initCache
in interface XWikiGroupService
XWikiException
public void flushCache()
flushCache
in interface XWikiGroupService
protected boolean isAllGroupImplicit(XWikiContext context)
xwiki.authentication.group.allgroupimplicit
parameter in xwiki.cfg
.context
- the current XWiki contexttrue
if the group is implicit and all users should be by default in it, false
if the
group behaves as all other groups, containing only the users/subgroups that are explicitly listed inside
the document.@Deprecated public Collection<String> listGroupsForUser(String member, XWikiContext context) throws XWikiException
listGroupsForUser
in interface XWikiGroupService
XWikiException
@Deprecated public void addUserToGroup(String username, String database, String group, XWikiContext context) throws XWikiException
addUserToGroup
in interface XWikiGroupService
XWikiException
public void replaceMemberInAllGroups(DocumentReference memberSourceReference, DocumentReference memberTargetReference, XWikiContext context) throws XWikiException
XWikiGroupService
replaceMemberInAllGroups
in interface XWikiGroupService
memberSourceReference
- the reference of the member that should be replacedmemberTargetReference
- the reference of the member that is used as replacementcontext
- the current contextXWikiException
- in case of problem when doing the replacementpublic void removeUserOrGroupFromAllGroups(String memberWiki, String memberSpace, String memberName, XWikiContext context) throws XWikiException
XWikiGroupService
removeUserOrGroupFromAllGroups
in interface XWikiGroupService
memberWiki
- the name of the wiki of the member.memberSpace
- the name of the space of the member.memberName
- the name of the member.context
- the XWiki context.XWikiException
- error when browsing groups.@Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException
listMemberForGroup
in interface XWikiGroupService
XWikiException
@Deprecated public List<String> listAllGroups(XWikiContext context) throws XWikiException
listAllGroups
in interface XWikiGroupService
XWikiException
public String getName()
getName
in interface org.xwiki.observation.EventListener
public List<org.xwiki.observation.event.Event> getEvents()
getEvents
in interface org.xwiki.observation.EventListener
public void onEvent(org.xwiki.observation.event.Event event, Object source, Object data)
onEvent
in interface org.xwiki.observation.EventListener
public List<?> getAllMatchedUsers(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order, XWikiContext context) throws XWikiException
XWikiGroupService
getAllMatchedUsers
in interface XWikiGroupService
matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if a List
containing String
names is returned or List
containing XWikiDocument
.nb
- the maximum number of results to return. Infinite if 0.start
- the index of the first found user to return.order
- the fields to order from. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when getting users.public List<?> getAllMatchedGroups(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order, XWikiContext context) throws XWikiException
XWikiGroupService
getAllMatchedGroups
in interface XWikiGroupService
matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if a List
containing String
names is returned or List
containing XWikiDocument
.nb
- the maximum number of result to return. Infinite if 0.start
- the index of the first found group to return.order
- the field to order from. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when getting groups.protected String createMatchUserOrGroupWhereClause(boolean user, Object[][] matchFields, Object[][] order, List<Object> parameterValues)
XWikiStoreInterface
searchDocuments and searchDocumentsNames methods.user
- if true search for users, otherwise search for groups.matchFields
- the field to math with values. It is a table of table with :
order
- the field to order from. It is a table of table with :
parameterValues
- the list of values to fill for use with HQL named request.protected List<?> getAllMatchedUsersOrGroups(boolean user, Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order, XWikiContext context) throws XWikiException
user
- if true search for users, otherwise search for groups.matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if a List
containing String
names is returned or List
containing XWikiDocument
.nb
- the maximum number of results to return. Infinite if 0.start
- the index of the first found user or group to return.order
- the field to order from. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when calling for
XWikiStoreInterface.searchDocuments(String, int, int, List, XWikiContext)
or
XWikiStoreInterface.searchDocumentsNames(String, int, int, List, XWikiContext)
protected int countAllMatchedUsersOrGroups(boolean user, Object[][] matchFields, XWikiContext context) throws XWikiException
user
- if true search for users, otherwise search for groups.matchFields
- the field to math with values. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when calling for
XWikiStoreInterface.search(String, int, int, List, XWikiContext)
public int countAllMatchedUsers(Object[][] matchFields, XWikiContext context) throws XWikiException
XWikiGroupService
countAllMatchedUsers
in interface XWikiGroupService
matchFields
- the field to math with values. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when getting number of users.public int countAllMatchedGroups(Object[][] matchFields, XWikiContext context) throws XWikiException
XWikiGroupService
countAllMatchedGroups
in interface XWikiGroupService
matchFields
- the field to math with values. It is a table of table with :
context
- the XWikiContext
.XWikiException
- error when getting number of groups.protected String createMatchGroupMembersWhereClause(String groupFullName, String matchField, Boolean orderAsc, Map<String,Object> parameterValues)
groupFullName
- the fill wiki name of the group.matchField
- a string to search in result to filter.orderAsc
- if true, the result is ordered ascendent, if false it descendant. If null no order is applied.parameterValues
- the values to insert in names query.public Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context) throws XWikiException
XWikiGroupService
Since 10.8RC1 it's recommended to use org.xwiki.user.group.GroupManager unless you want to bypass the cache.
getAllGroupsNamesForMember
in interface XWikiGroupService
member
- the name of the member (user or group).nb
- the maximum number of result to return.start
- the index of the first found member to return.context
- the XWiki context.Collection
of String
containing group name.XWikiException
- error when browsing groups.public Collection<DocumentReference> getAllGroupsReferencesForMember(DocumentReference memberReference, int limit, int offset, XWikiContext context) throws XWikiException
XWikiGroupService
Since 10.8RC1 it's recommended to use org.xwiki.user.group.GroupManager unless you want to bypass the cache.
getAllGroupsReferencesForMember
in interface XWikiGroupService
memberReference
- the member. Can be either user or group.limit
- the maximum number of result to return.offset
- the index of the first found member to return.context
- the XWiki context.Collection
of DocumentReference
containing representing groups.XWikiException
- error when browsing groups.public Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context) throws XWikiException
XWikiGroupService
Since 10.8RC1 it's recommended to use org.xwiki.user.group.GroupManager unless you want to bypass the cache.
getAllMembersNamesForGroup
in interface XWikiGroupService
group
- the name of the group.nb
- the maximum number of result to return.start
- the index of the first found user to return.context
- the XWiki context.Collection
of String
containing member name.XWikiException
- error when browsing groups.public Collection<String> getAllMatchedMembersNamesForGroup(String group, String matchField, int nb, int start, Boolean orderAsc, XWikiContext context) throws XWikiException
XWikiGroupService
getAllMatchedMembersNamesForGroup
in interface XWikiGroupService
group
- the group.matchField
- a string to search in result to filter.nb
- the maximum number of result to return.start
- the index of the first found user to return.orderAsc
- if true, the result is ordered ascendent, if false it descendant. If null no order is applied.context
- the XWiki context.Collection
of String
containing member name.XWikiException
- error when browsing groups.public int countAllMatchedMembersNamesForGroup(String group, String filter, XWikiContext xcontext) throws XWikiException
XWikiGroupService
countAllMatchedMembersNamesForGroup
in interface XWikiGroupService
group
- the group whose members are going to be countedfilter
- the text used to filter the group membersxcontext
- the XWiki contextXWikiException
- if counting the group members failsXWikiGroupService.getAllMatchedMembersNamesForGroup(String, String, int, int, Boolean, XWikiContext)
public int countAllGroupsNamesForMember(String member, XWikiContext context) throws XWikiException
XWikiGroupService
Since 10.8RC1 it's recommended to use org.xwiki.user.group.GroupManager unless you want to bypass the cache.
countAllGroupsNamesForMember
in interface XWikiGroupService
member
- the name of the member (user or group).context
- the XWiki context.XWikiException
- error when getting number of users.public int countAllMembersNamesForGroup(String group, XWikiContext context) throws XWikiException
XWikiGroupService
Since 10.8RC1 it's recommended to use org.xwiki.user.group.GroupManager unless you want to bypass the cache.
countAllMembersNamesForGroup
in interface XWikiGroupService
group
- the name of the group.context
- the XWiki context.XWikiException
- error when getting number of groups.Copyright © 2004–2022 XWiki. All rights reserved.