Class DefaultMembershipCache
- java.lang.Object
-
- com.atlassian.confluence.impl.user.crowd.DefaultMembershipCache
-
- All Implemented Interfaces:
MembershipCache
public final class DefaultMembershipCache extends Object implements MembershipCache
The cache maps aCachedCrowdMembershipCacheKeyrepresenting a user (or group) in a particular directory to aMap<String, String>where each entry in the map represents a group that the user (or group) is a member of.The key of each Map entry is the lowercase name of the user or child group. The value is the case-preserved actual name of the entity.
- Since:
- 3.5
-
-
Constructor Summary
Constructors Constructor Description DefaultMembershipCache(TransactionAwareCacheFactory cacheFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getGroupsForGroup(long directoryId, String groupName)Returns the list of groups names which the named group is a member of in the specified directory.List<String>getGroupsForGroup(long directoryId, String groupName, Supplier<List<String>> valueSupplier)Returns the list of groups names which the named group is a member of in the specified directory.List<String>getGroupsForUser(long directoryId, String userName)List<String>getGroupsForUser(long directoryId, String userName, Supplier<List<String>> valueSupplier)Returns the list of groups names which the named user is a member of in the specified directory.BooleanisGroupDirectMember(long directoryId, String groupName, String parentGroupName)booleanisGroupDirectMember(long directoryId, String childGroupName, String parentGroupName, Supplier<Iterable<String>> groupMembershipSupplier)Returnstrueif the parentGroupName is in the cached list of parents of the child group,falseif parentGroupName is not in the list,.BooleanisUserDirectMember(long directoryId, String userName, String groupName)booleanisUserDirectMember(long directoryId, String userName, String groupName, Supplier<Iterable<String>> groupMembershipSupplier)Returnstrueif the groupName is in the cached list of parents of the user,falseif groupName is not in the list.voidremoveAllDirectoryMemberships(long directoryId)Removes any entries in the cache which relate to the specified directory.voidremoveAllGroupMemberships(long directoryId, String groupName)Removes any entries in the cache which contain the groupName in the specified directory.voidremoveAllUserMemberships(long directoryId, String userName)Removes any entries in the cache which contain the userName in the specified directory.voidremoveGroupGroupMemberships(long directoryId, String groupName)Removes any cached list of group names which are members of the named group in the specified directory.voidremoveUserGroupMemberships(long directoryId, String userName)Removes any cached list of user names which are members of the named group in the specified directory.
-
-
-
Constructor Detail
-
DefaultMembershipCache
public DefaultMembershipCache(TransactionAwareCacheFactory cacheFactory)
- Since:
- 7.5
-
-
Method Detail
-
isUserDirectMember
public Boolean isUserDirectMember(long directoryId, String userName, String groupName)
-
isUserDirectMember
public boolean isUserDirectMember(long directoryId, String userName, String groupName, Supplier<Iterable<String>> groupMembershipSupplier)Description copied from interface:MembershipCacheReturnstrueif the groupName is in the cached list of parents of the user,falseif groupName is not in the list.- Specified by:
isUserDirectMemberin interfaceMembershipCachegroupMembershipSupplier- a Supplier of group names for the user, if not already present in the cache
-
isGroupDirectMember
public Boolean isGroupDirectMember(long directoryId, String groupName, String parentGroupName)
-
isGroupDirectMember
public boolean isGroupDirectMember(long directoryId, String childGroupName, String parentGroupName, Supplier<Iterable<String>> groupMembershipSupplier)Description copied from interface:MembershipCacheReturnstrueif the parentGroupName is in the cached list of parents of the child group,falseif parentGroupName is not in the list,.- Specified by:
isGroupDirectMemberin interfaceMembershipCachegroupMembershipSupplier- a Supplier of parent group names for the group, if not already present in the cache
-
getGroupsForUser
public List<String> getGroupsForUser(long directoryId, String userName, Supplier<List<String>> valueSupplier)
Description copied from interface:MembershipCacheReturns the list of groups names which the named user is a member of in the specified directory.- Specified by:
getGroupsForUserin interfaceMembershipCachevalueSupplier- a Supplier of group names for the user, if not already present in the cache
-
getGroupsForGroup
public List<String> getGroupsForGroup(long directoryId, String groupName)
Description copied from interface:MembershipCacheReturns the list of groups names which the named group is a member of in the specified directory. ornullif there is no cached list.- Specified by:
getGroupsForGroupin interfaceMembershipCache
-
getGroupsForGroup
public List<String> getGroupsForGroup(long directoryId, String groupName, Supplier<List<String>> valueSupplier)
Description copied from interface:MembershipCacheReturns the list of groups names which the named group is a member of in the specified directory.- Specified by:
getGroupsForGroupin interfaceMembershipCachevalueSupplier- a Supplier of the parent groups of the child group, if not already present in the cache.
-
removeUserGroupMemberships
public void removeUserGroupMemberships(long directoryId, String userName)Description copied from interface:MembershipCacheRemoves any cached list of user names which are members of the named group in the specified directory. Does nothing if there is no corresponding entry in the cache.- Specified by:
removeUserGroupMembershipsin interfaceMembershipCache
-
removeGroupGroupMemberships
public void removeGroupGroupMemberships(long directoryId, String groupName)Description copied from interface:MembershipCacheRemoves any cached list of group names which are members of the named group in the specified directory. Does nothing if there is no corresponding entry in the cache.- Specified by:
removeGroupGroupMembershipsin interfaceMembershipCache
-
removeAllUserMemberships
public void removeAllUserMemberships(long directoryId, String userName)Description copied from interface:MembershipCacheRemoves any entries in the cache which contain the userName in the specified directory.This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.
Removes any GROUPS_FOR_USER entry in this cache if it contains this group.
- Specified by:
removeAllUserMembershipsin interfaceMembershipCache
-
removeAllGroupMemberships
public void removeAllGroupMemberships(long directoryId, String groupName)Description copied from interface:MembershipCacheRemoves any entries in the cache which contain the groupName in the specified directory.This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.
Removes any GROUPS_FOR_GROUP entry in this cache for the passed in group. Removes any GROUPS_FOR_USER entry in this cache if it contains this group.
- Specified by:
removeAllGroupMembershipsin interfaceMembershipCache
-
removeAllDirectoryMemberships
public void removeAllDirectoryMemberships(long directoryId)
Description copied from interface:MembershipCacheRemoves any entries in the cache which relate to the specified directory.This can be a slow operation if the cache is large. This is a trade-off of the cache design, which is optimised for fast retrieval of all parent groups of a user or group.
- Specified by:
removeAllDirectoryMembershipsin interfaceMembershipCache
-
-