User API

Version 8.1 by Thomas Mortagne on 2018/09/14 10:14

cogProvide APIs to manipulate users and groups
TypeJAR
CategoryAPI
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU General Public License 1
Bundled With

XWiki Standard

Compatibility

Since 10.8RC1

Description

Users

Nothing yet.

Groups

The org.xwiki.user.group.GroupManager component allows getting information about the groups and their members.

Everything you request trough this component is cached for fast access.

Member's groups

/**
     * Search groups the passed user or group is member of.
     * <p>
     * {code wikis} controls where to search for the groups and {@code recurse} only the direct group should be
     * returned or the whole hierarchy.
     *
     * @param member the group member (user or group)
     * @param wikiTarget the wikis where to search. The following types are supported:
     *            <ul>
     *            <li>{@link org.xwiki.user.group.WikiTarget}</li>
     *            <li>{@link String}</li>
     *            <li>{@code Collection<String>}</li>
     *            <li>{@code org.xwiki.model.reference.WikiReference}</li>
     *            <li>{@code Collection<org.xwiki.model.reference.WikiReference>}</li>
     *            </ul>
     * @param recurse false if only the direct groups should be returned, true to take into account groups of groups
     * @return the groups the passed user or group is member of
     * @throws GroupException when failing to get groups
     */

    Collection<DocumentReference> getGroups(DocumentReference member, Object wikiTarget, boolean recurse)
       throws GroupException;

Group's members

    /**
     * Retrieve the users and groups which are the members of the passed group.
     *
     * @param group the group for which to return the members
     * @param recurse false if only the direct members should be returned, true to take into account groups of groups
     * @return the members of the passed group
     * @throws GroupException when failing to get members
     */

    Collection<DocumentReference> getMembers(DocumentReference group, boolean recurse) throws GroupException;

Get Connected