public final class RightsManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_USERORGROUP_SPACE
Name of the default space where users and groups are stored.
|
Modifier and Type | Method and Description |
---|---|
int |
countAllGlobalUsersOrGroups(boolean user,
Object[][] matchFields,
XWikiContext context)
Get the number of users or groups in the main wiki.
|
int |
countAllGroupsNamesForMember(String member,
XWikiContext context)
Deprecated.
since 10.8RC1, use org.xwiki.user.group.GroupManager component instead
|
int |
countAllLocalUsersOrGroups(boolean user,
Object[][] matchFields,
XWikiContext context)
Get the number of users or groups in the current wiki.
|
int |
countAllMatchedMembersNamesForGroup(String group,
String filter,
XWikiContext xcontext)
Filters the members of the specified group using the given text and counts the results.
|
int |
countAllMembersNamesForGroup(String group,
XWikiContext context)
Deprecated.
since 10.8RC1, use org.xwiki.user.group.GroupManager component instead
|
int |
countAllUsersOrGroups(boolean user,
Object[][] matchFields,
XWikiContext context)
Get the number of users or groups in the main wiki and the current wiki.
|
int |
countAllWikiUsersOrGroups(boolean user,
String wikiName,
Object[][] matchFields,
XWikiContext context)
Get the number of users or groups in the provided wiki.
|
Collection<String> |
getAllGroupsNamesForMember(String member,
int nb,
int start,
XWikiContext context)
Deprecated.
since 10.8RC1, use org.xwiki.user.group.GroupManager component instead
|
List<?> |
getAllMatchedGlobalUsersOrGroups(boolean user,
Object[][] matchFields,
boolean withdetails,
RequestLimit limit,
Object[][] order,
XWikiContext context)
Get all users or groups in the main wiki.
|
List<?> |
getAllMatchedLocalUsersOrGroups(boolean user,
Object[][] matchFields,
boolean withdetails,
RequestLimit limit,
Object[][] order,
XWikiContext context)
Get all users or groups in the current wiki.
|
Collection<String> |
getAllMatchedMembersNamesForGroup(String group,
String matchField,
int nb,
int start,
Boolean orderAsc,
XWikiContext context)
Get members of provided group.
|
List<?> |
getAllMatchedUsersOrGroups(boolean user,
Object[][] matchFields,
boolean withdetails,
RequestLimit limit,
Object[][] order,
XWikiContext context)
Get all users or groups in the main wiki and the current.
|
List<?> |
getAllMatchedWikiUsersOrGroups(boolean user,
String wikiName,
Object[][] matchFields,
boolean withdetails,
RequestLimit limit,
Object[][] order,
XWikiContext context)
Get all users or groups in the provided wiki.
|
Collection<String> |
getAllMembersNamesForGroup(String group,
int nb,
int start,
XWikiContext context)
Deprecated.
since 10.8RC1, use org.xwiki.user.group.GroupManager component instead
|
static RightsManager |
getInstance() |
Map<String,LevelTree> |
getLevelTreeMap(String spaceOrPage,
List<String> levelsToMatch,
XWikiContext context)
|
XWikiDocument |
getParentPreference(String spaceOrPage,
XWikiContext context)
Get the document containing inherited rights of provided document.
|
XWikiDocument |
getParentPreference(XWikiDocument currentPreference,
boolean currentGlobal,
XWikiContext context)
Get the document containing inherited rights of provided document.
|
LevelTree |
getTreeLevel(String spaceOrPage,
String levelName,
XWikiContext context)
Get level right tree.
|
boolean |
groupContainsMember(String groupName,
String memberName,
Map<String,Collection<String>> groupCacheIn,
XWikiContext context)
Browse a group and groups it contains to find provided member (user or group).
|
void |
removeDirectRights(String spaceOrPage,
List<String> levelNames,
String comment,
XWikiContext context)
Remove "direct" rights for wiki, space or document.
|
void |
removeUserOrGroupFromAllRights(String userOrGroupWiki,
String userOrGroupSpace,
String userOrGroupName,
boolean user,
XWikiContext context)
Remove all references to provided user or group from all rights documents.
|
boolean |
removeUserOrGroupFromAllRights(XWikiDocument rightsDocument,
String userOrGroupWiki,
String userOrGroupSpace,
String userOrGroupName,
boolean user,
XWikiContext context)
Remove all references to provided user or group from provided rights document.
|
void |
removeUserOrGroupFromLevel(String spaceOrPage,
String userOrGroup,
boolean user,
String levelName,
boolean allow,
String comment,
XWikiContext context)
Remove a user or group from rights preferences document for provided level.
|
boolean |
removeUserOrGroupFromRight(BaseObject right,
String userOrGroupWiki,
String userOrGroupSpace,
String userOrGroupName,
boolean user,
XWikiContext context)
Remove all references to provided user or group from provided right object.
|
boolean |
removeUserOrGroupFromRights(XWikiDocument rightsDocument,
String userOrGroupWiki,
String userOrGroupSpace,
String userOrGroupName,
boolean user,
boolean global,
XWikiContext context)
Remove all references to provided user or group from provided rights document.
|
void |
replaceUserOrGroupFromAllRights(DocumentReference userOrGroupSourceReference,
DocumentReference userOrGroupTargetReference,
boolean user,
XWikiContext context)
Replace a user or a group reference with another one on all rights of the current wiki.
|
Collection<DocumentReference> |
resolveUsers(DocumentReference userOrGroup,
XWikiContext context)
Resolve passed user or group into users references list.
|
Collection<DocumentReference> |
resolveUsers(List<String> referenceList,
XWikiContext context)
Resolve passed users and groups into users references list.
|
Collection<DocumentReference> |
resolveUsers(String userOrGroup,
XWikiContext context)
Resolve passed user or group into users references list.
|
public static final String DEFAULT_USERORGROUP_SPACE
public static RightsManager getInstance()
public int countAllUsersOrGroups(boolean user, Object[][] matchFields, XWikiContext context) throws XWikiException
user
- indicate if methods search for users or groups.matchFields
- the field to math with values. It is a table of table with :
context
- the XWiki context.XWikiException
- error when getting number of users or groups.public int countAllWikiUsersOrGroups(boolean user, String wikiName, Object[][] matchFields, XWikiContext context) throws XWikiException
user
- indicate if methods search for users or groups.wikiName
- the name of the wiki where to search for users or groups.matchFields
- the field to math with values. It is a table of table with :
context
- the XWiki context.XWikiException
- error when getting number of users or groups.public int countAllGlobalUsersOrGroups(boolean user, Object[][] matchFields, XWikiContext context) throws XWikiException
user
- indicate if methods search for users or groups.matchFields
- the field to math with values. It is a table of table with :
context
- the XWiki context.XWikiException
- error when getting number of users or groups.public int countAllLocalUsersOrGroups(boolean user, Object[][] matchFields, XWikiContext context) throws XWikiException
user
- indicate if methods search for users or groups.matchFields
- the field to math with values. It is a table of table with :
context
- the XWiki context.XWikiException
- error when getting number of users or groups.public List<?> getAllMatchedUsersOrGroups(boolean user, Object[][] matchFields, boolean withdetails, RequestLimit limit, Object[][] order, XWikiContext context) throws XWikiException
user
- indicate if it is a user or a group.matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if the methods return List
or String
or List
of
XWikiDocument
.limit
- the maximum number of result to return and index of the first element.order
- the fields to order from. It is a table of table with :
context
- the XWiki context.List
of String
containing user or group name if withdetails
is false,
otherwise a List
of XWikiDocument
containing user or group.XWikiException
- error when searching from users or groups.public List<?> getAllMatchedGlobalUsersOrGroups(boolean user, Object[][] matchFields, boolean withdetails, RequestLimit limit, Object[][] order, XWikiContext context) throws XWikiException
user
- indicate if it is a user or a group.matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if the methods return List
or String
or List
of
XWikiDocument
.limit
- the maximum number of result to return and index of the first element.order
- the fields to order from. It is a table of table with :
context
- the XWiki context.List
of String
containing user or group name if withdetails
is false,
otherwise a List
of XWikiDocument
containing user or group.XWikiException
- error when searching from users or groups.public List<?> getAllMatchedWikiUsersOrGroups(boolean user, String wikiName, Object[][] matchFields, boolean withdetails, RequestLimit limit, Object[][] order, XWikiContext context) throws XWikiException
user
- indicate if it is a user or a group.wikiName
- the name of the wiki where to search.matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if the methods return List
or String
or List
of
XWikiDocument
.limit
- the maximum number of result to return and index of the first element.order
- the fields to order from. It is a table of table with :
context
- the XWiki context.List
of String
containing user or group name if withdetails
is false,
otherwise a List
of XWikiDocument
containing user or group.XWikiException
- error when searching from users or groups.public List<?> getAllMatchedLocalUsersOrGroups(boolean user, Object[][] matchFields, boolean withdetails, RequestLimit limit, Object[][] order, XWikiContext context) throws XWikiException
user
- indicate if it is a user or a group.matchFields
- the field to math with values. It is a table of table with :
withdetails
- indicate if the methods return List
or String
or List
of
XWikiDocument
.limit
- the maximum number of result to return and index of the first element.order
- the fields to order from. It is a table of table with :
context
- the XWiki context.List
of String
containing user or group name if withdetails
is false,
otherwise a List
of XWikiDocument
containing user or group.XWikiException
- error when searching from users or groups.@Deprecated public Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context) throws XWikiException
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.@Deprecated public Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context) throws XWikiException
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 user name.XWikiException
- error when browsing groups.public Collection<String> getAllMatchedMembersNamesForGroup(String group, String matchField, int nb, int start, Boolean orderAsc, XWikiContext context) throws XWikiException
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
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 failsgetAllMatchedMembersNamesForGroup(String, String, int, int, Boolean, XWikiContext)
@Deprecated public int countAllGroupsNamesForMember(String member, XWikiContext context) throws XWikiException
member
- the name of the member (user or group).context
- the XWiki context.XWikiException
- error when getting number of users.@Deprecated public int countAllMembersNamesForGroup(String group, XWikiContext context) throws XWikiException
group
- the name of the group.context
- the XWiki context.XWikiException
- error when getting number of groups.public Map<String,LevelTree> getLevelTreeMap(String spaceOrPage, List<String> levelsToMatch, XWikiContext context) throws XWikiException
spaceOrPage
- the space of page where to get XWikiRights. If null get wiki rights.levelsToMatch
- the levels names to check ("view", "edit", etc.).context
- the XWiki context.Map
containing [levelname : LevelTree
].XWikiException
- error when browsing rights preferences.public XWikiDocument getParentPreference(XWikiDocument currentPreference, boolean currentGlobal, XWikiContext context) throws XWikiException
currentPreference
- the document for which to find parent preferences document.currentGlobal
- indicate if current preferences document is global.context
- the XWiki context.XWikiException
- error when browsing rights preferences.public XWikiDocument getParentPreference(String spaceOrPage, XWikiContext context) throws XWikiException
spaceOrPage
- the space of page where to get XWikiRights. If null get wiki rights.context
- the XWiki context.XWikiException
- error when browsing rights preferences.public LevelTree getTreeLevel(String spaceOrPage, String levelName, XWikiContext context) throws XWikiException
spaceOrPage
- the space of page where to get XWikiRights. If null get wiki rights.levelName
- the level right name ("view", "delete"...).context
- the XWiki context.LevelTree
.XWikiException
- error when browsing rights.public void removeUserOrGroupFromLevel(String spaceOrPage, String userOrGroup, boolean user, String levelName, boolean allow, String comment, XWikiContext context) throws XWikiException
spaceOrPage
- the space of page where to get XWikiRights. If null get wiki rights.userOrGroup
- the name of the user or group.user
- indicate if it is a user or group.levelName
- the name of the right level.allow
- indicate if user is removed from allow right or deny right.comment
- the comment to use when saving preferences document.context
- the XWiki context.XWikiException
- error when browsing rights.public boolean removeUserOrGroupFromRight(BaseObject right, String userOrGroupWiki, String userOrGroupSpace, String userOrGroupName, boolean user, XWikiContext context)
right
- the object containing the right preferences.userOrGroupWiki
- the name of the wiki of the use or group.userOrGroupSpace
- the name of the space of the use or group.userOrGroupName
- the name of the use or group.user
- indicate if it is a user or a group.context
- the XWiki context.public boolean removeUserOrGroupFromRights(XWikiDocument rightsDocument, String userOrGroupWiki, String userOrGroupSpace, String userOrGroupName, boolean user, boolean global, XWikiContext context)
rightsDocument
- the document containing the rights preferences.userOrGroupWiki
- the name of the wiki of the use or group.userOrGroupSpace
- the name of the space of the use or group.userOrGroupName
- the name of the use or group.user
- indicate if it is a user or a group.global
- indicate if user or group is removed from global or document rights.context
- the XWiki context.public boolean removeUserOrGroupFromAllRights(XWikiDocument rightsDocument, String userOrGroupWiki, String userOrGroupSpace, String userOrGroupName, boolean user, XWikiContext context)
rightsDocument
- the document containing the rights preferences.userOrGroupWiki
- the name of the wiki of the use or group.userOrGroupSpace
- the name of the space of the use or group.userOrGroupName
- the name of the use or group.user
- indicate if it is a user or a group.context
- the XWiki context.public void removeUserOrGroupFromAllRights(String userOrGroupWiki, String userOrGroupSpace, String userOrGroupName, boolean user, XWikiContext context) throws XWikiException
userOrGroupWiki
- the name of the wiki of the use or group.userOrGroupSpace
- the name of the space of the use or group.userOrGroupName
- the name of the use or group.user
- indicate if it is a user or a group.context
- the XWiki context.XWikiException
- error when browsing rights.public void replaceUserOrGroupFromAllRights(DocumentReference userOrGroupSourceReference, DocumentReference userOrGroupTargetReference, boolean user, XWikiContext context) throws XWikiException
userOrGroupSourceReference
- the reference of the user or group that we need to replaceuserOrGroupTargetReference
- the reference of the user or group that will be used as replacementuser
- if true
the reference will be looked in the users properties, else in the groups onecontext
- the current contextXWikiException
- in case of errorspublic void removeDirectRights(String spaceOrPage, List<String> levelNames, String comment, XWikiContext context) throws XWikiException
spaceOrPage
- the space of page where to get XWikiRights. If null get wiki rights.levelNames
- the levels names to check ("view", "edit", etc.).comment
- the comment to use when saving preferences document.context
- the XWiki context.XWikiException
- error when browsing rights.public boolean groupContainsMember(String groupName, String memberName, Map<String,Collection<String>> groupCacheIn, XWikiContext context) throws XWikiException
groupName
- the group name where to search for member.memberName
- the name of the member to find.groupCacheIn
- a map containing a set a group and its corresponding members already retrieved.context
- the XWiki context.XWikiException
- error when browsing groups.public Collection<DocumentReference> resolveUsers(DocumentReference userOrGroup, XWikiContext context) throws XWikiException
userOrGroup
- the user or groupcontext
- the XWikiContext the XWiki contextXWikiException
- error when getting documentspublic Collection<DocumentReference> resolveUsers(String userOrGroup, XWikiContext context) throws XWikiException
userOrGroup
- the user or groupcontext
- the XWikiContext the XWiki contextXWikiException
- error when getting documentspublic Collection<DocumentReference> resolveUsers(List<String> referenceList, XWikiContext context) throws XWikiException
referenceList
- the list of users and groupscontext
- the XWikiContext the XWiki contextXWikiException
- error when getting documentsCopyright © 2004–2022 XWiki. All rights reserved.