Details
-
Improvement
-
Resolution: Fixed
-
Major
-
18.9.0
-
None
Description
GroupManager (the recommended replacement for the deprecated User#isUserInGroup, see XWIKI-22786) has no way to answer "is this user or group a member of this group?" without materializing a collection: getMembers(group, false).contains(member).
Add a default method GroupManager#isMember(DocumentReference member, DocumentReference group, boolean recurse), plus the matching $services.user.group.isMember(member, group, recurse) script API.
The default implementation starts from the member's groups (getGroups) rather than the group's members, since a user is usually in a few groups while a group can have thousands of members. When recursing, it searches the member's wiki and the group's wiki, so that a global user who belongs to a subwiki group through a global group is found.
Agreed on the forum: https://forum.xwiki.org/t/add-groupmanager-ismember-member-group-recurse/18701
Attachments
Issue Links
- is related to
-
XWIKI-25766 Group cache can keep a stale recursive membership when a group is modified while it's being resolved
-
- Open
-
- relates to
-
XWIKI-22786 Update or mark method User#isUserInGroup as deprecated
-
- Closed
-