public class IncludingGroupMembership extends java.lang.Object implements GroupMembership
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.
Modifier and Type | Class and Description |
---|---|
static interface |
IncludingGroupMembership.Factory |
EMPTY
Modifier and Type | Method and Description |
---|---|
boolean |
contains(AccountGroup.UUID id)
Returns
true when the user this object was created for is a member of the specified
group. |
boolean |
containsAnyOf(java.lang.Iterable<AccountGroup.UUID> queryIds)
Returns
true when the user this object was created for is a member of any of the
specified group. |
java.util.Set<AccountGroup.UUID> |
getKnownGroups()
Returns the set of groups that can be determined by the implementation.
|
java.util.Set<AccountGroup.UUID> |
intersection(java.lang.Iterable<AccountGroup.UUID> groupIds)
Returns a set containing an input member of
contains(id) is true. |
public boolean contains(AccountGroup.UUID id)
GroupMembership
true
when the user this object was created for is a member of the specified
group.contains
in interface GroupMembership
public boolean containsAnyOf(java.lang.Iterable<AccountGroup.UUID> queryIds)
GroupMembership
true
when the user this object was created for is a member of any of the
specified group.containsAnyOf
in interface GroupMembership
public java.util.Set<AccountGroup.UUID> intersection(java.lang.Iterable<AccountGroup.UUID> groupIds)
GroupMembership
contains(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);
intersection
in interface GroupMembership
public java.util.Set<AccountGroup.UUID> getKnownGroups()
GroupMembership
GroupMembership.contains(AccountGroup.UUID)
would return true
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.getKnownGroups
in interface GroupMembership