| 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 |