Package com.google.gerrit.server.account
Interface GroupMembership
-
- All Known Implementing Classes:
IncludingGroupMembership
,ListGroupMembership
public interface GroupMembership
Represents the set of groups that a single user is part of.Different accounts systems (eg. LDAP, gerrit groups) provide concrete implementations.
-
-
Field Summary
Fields Modifier and Type Field Description static GroupMembership
EMPTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
contains(AccountGroup.UUID groupId)
Returnstrue
when the user this object was created for is a member of the specified group.boolean
containsAnyOf(Iterable<AccountGroup.UUID> groupIds)
Returnstrue
when the user this object was created for is a member of any of the specified group.Set<AccountGroup.UUID>
getKnownGroups()
Returns the set of groups that can be determined by the implementation.Set<AccountGroup.UUID>
intersection(Iterable<AccountGroup.UUID> groupIds)
Returns a set containing an input member ofcontains(id)
is true.
-
-
-
Field Detail
-
EMPTY
static final GroupMembership EMPTY
-
-
Method Detail
-
contains
boolean contains(AccountGroup.UUID groupId)
Returnstrue
when the user this object was created for is a member of the specified group.
-
containsAnyOf
boolean containsAnyOf(Iterable<AccountGroup.UUID> groupIds)
Returnstrue
when the user this object was created for is a member of any of the specified group.
-
intersection
Set<AccountGroup.UUID> intersection(Iterable<AccountGroup.UUID> groupIds)
Returns a set containing an input member ofcontains(id)
is true.This is batch form of contains that returns specific group information. Implementors may implement the method as:
Set<AccountGroup.UUID> r = new HashSet<>(); for (AccountGroup.UUID id : groupIds) if (contains(id)) r.add(id);
-
getKnownGroups
Set<AccountGroup.UUID> getKnownGroups()
Returns the set of groups that can be determined by the implementation. This may not return all groups thecontains(AccountGroup.UUID)
would returntrue
for, but will at least contain all top level groups. This restriction stems from the API of some group systems, which make it expensive to enumerate the members of a group.
-
-