Package com.google.gerrit.server.account
Class IncludingGroupMembership
- java.lang.Object
-
- com.google.gerrit.server.account.IncludingGroupMembership
-
- All Implemented Interfaces:
GroupMembership
public class IncludingGroupMembership extends Object implements GroupMembership
Determines membership in the internal group system for a given user.Groups the user is directly a member of are pulled from the in-memory AccountCache by way of the IdentifiedUser. Transitive group memberhips are resolved on demand starting from the requested group and looking for a path to a group the user is a member of. Other group backends are supported by recursively invoking the universal GroupMembership.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
IncludingGroupMembership.Factory
-
Field Summary
-
Fields inherited from interface com.google.gerrit.server.account.GroupMembership
EMPTY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(AccountGroup.UUID id)
Returnstrue
when the user this object was created for is a member of the specified group.boolean
containsAnyOf(Iterable<AccountGroup.UUID> queryIds)
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.
-
-
-
Method Detail
-
contains
public boolean contains(AccountGroup.UUID id)
Description copied from interface:GroupMembership
Returnstrue
when the user this object was created for is a member of the specified group.- Specified by:
contains
in interfaceGroupMembership
-
containsAnyOf
public boolean containsAnyOf(Iterable<AccountGroup.UUID> queryIds)
Description copied from interface:GroupMembership
Returnstrue
when the user this object was created for is a member of any of the specified group.- Specified by:
containsAnyOf
in interfaceGroupMembership
-
intersection
public Set<AccountGroup.UUID> intersection(Iterable<AccountGroup.UUID> groupIds)
Description copied from interface:GroupMembership
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);
- Specified by:
intersection
in interfaceGroupMembership
-
getKnownGroups
public Set<AccountGroup.UUID> getKnownGroups()
Description copied from interface:GroupMembership
Returns the set of groups that can be determined by the implementation. This may not return all groups theGroupMembership.contains(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.- Specified by:
getKnownGroups
in interfaceGroupMembership
-
-