Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25732

Add GroupManager#isMember(member, group, recurse)

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.10.0-rc-1
    • 18.9.0
    • User
    • None
    • Unknown

    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

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: