public class GroupCache
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private org.apache.directory.api.ldap.model.name.Dn |
administratorsGroupDn
the normalized dn of the administrators group
|
private DirectoryService |
directoryService
the directory service
|
private DnFactory |
dnFactory
the Dn factory
|
private net.sf.ehcache.Cache |
ehCache
String key for the Dn of a group to a Set (HashSet) for the Strings of member DNs
|
private static java.util.Set<org.apache.directory.api.ldap.model.name.Dn> |
EMPTY_GROUPS |
private static boolean |
IS_DEBUG
Speedup for logs
|
private static org.slf4j.Logger |
LOG
the logger for this class
|
private PartitionNexus |
nexus
a handle on the partition nexus
|
private org.apache.directory.api.ldap.model.schema.SchemaManager |
schemaManager
the schema manager
|
| Constructor and Description |
|---|
GroupCache(DirectoryService dirService)
Creates a static group cache.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addMembers(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.Attribute members)
Adds normalized member DNs to the set of normalized member names.
|
java.util.Set<org.apache.directory.api.ldap.model.name.Dn> |
getGroups(java.lang.String member)
Gets the set of groups a user is a member of.
|
private org.apache.directory.api.ldap.model.entry.Attribute |
getMemberAttribute(org.apache.directory.api.ldap.model.entry.Entry entry)
Gets the member attribute regardless of whether groupOfNames or
groupOfUniqueNames is used.
|
void |
groupAdded(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry entry)
Adds a groups members to the cache.
|
void |
groupDeleted(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry entry)
Deletes a group's members from the cache.
|
void |
groupModified(org.apache.directory.api.ldap.model.name.Dn name,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> mods,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
Modifies the cache to reflect changes via modify operations to the group entries.
|
void |
groupModified(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp,
org.apache.directory.api.ldap.model.entry.Entry mods)
Modifies the cache to reflect changes via modify operations to the group entries.
|
boolean |
groupRenamed(org.apache.directory.api.ldap.model.name.Dn oldName,
org.apache.directory.api.ldap.model.name.Dn newName) |
private void |
initialize(CoreSession session) |
boolean |
isPrincipalAnAdministrator(org.apache.directory.api.ldap.model.name.Dn principalDn)
An optimization.
|
private void |
modify(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp,
org.apache.directory.api.ldap.model.entry.Attribute members)
Utility method to modify a set of member names based on a modify operation
that changes the members of a group.
|
private org.apache.directory.api.ldap.model.name.Dn |
parseNormalized(java.lang.String name) |
private void |
removeMembers(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.Attribute members)
Removes a set of member names from an existing set.
|
private static final org.slf4j.Logger LOG
private static final boolean IS_DEBUG
private final PartitionNexus nexus
private final DirectoryService directoryService
private org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
private DnFactory dnFactory
private org.apache.directory.api.ldap.model.name.Dn administratorsGroupDn
private static final java.util.Set<org.apache.directory.api.ldap.model.name.Dn> EMPTY_GROUPS
private net.sf.ehcache.Cache ehCache
public GroupCache(DirectoryService dirService) throws org.apache.directory.api.ldap.model.exception.LdapException
dirService - the directory service coreorg.apache.directory.api.ldap.model.exception.LdapException - if there are failures on initializationprivate org.apache.directory.api.ldap.model.name.Dn parseNormalized(java.lang.String name)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void initialize(CoreSession session) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate org.apache.directory.api.ldap.model.entry.Attribute getMemberAttribute(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
entry - the entry inspected for member attributesorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void addMembers(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.Attribute members)
throws org.apache.directory.api.ldap.model.exception.LdapException
memberSet - the set of member Dns (Strings)members - the member attribute values being addedorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing the attr valuesprivate void removeMembers(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.Attribute members)
throws org.apache.directory.api.ldap.model.exception.LdapException
memberSet - the set of normalized member DNsmembers - the set of member valuesorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing the attr valuespublic void groupAdded(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
name - the user provided name for the group entryentry - the group entry's attributesorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing the attr valuespublic void groupDeleted(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
name - the normalized Dn of the group entryentry - the attributes of entry being deletedorg.apache.directory.api.ldap.model.exception.LdapExceptionprivate void modify(java.util.Set<java.lang.String> memberSet,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp,
org.apache.directory.api.ldap.model.entry.Attribute members)
throws org.apache.directory.api.ldap.model.exception.LdapException
memberSet - the set of members to be alteredmodOp - the type of modify operation being performedmembers - the members being added, removed or replacedorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing attribute valuespublic void groupModified(org.apache.directory.api.ldap.model.name.Dn name,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> mods,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
throws org.apache.directory.api.ldap.model.exception.LdapException
name - the normalized name of the group entry modifiedmods - the modification operations being performedentry - the group entry being modifiedorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing attribute valuespublic void groupModified(org.apache.directory.api.ldap.model.name.Dn name,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp,
org.apache.directory.api.ldap.model.entry.Entry mods)
throws org.apache.directory.api.ldap.model.exception.LdapException
name - the normalized name of the group entry modifiedmodOp - the modify operation being performedmods - the modifications being performedorg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing attribute valuespublic final boolean isPrincipalAnAdministrator(org.apache.directory.api.ldap.model.name.Dn principalDn)
principalDn - the normalized Dn of the user to check if they are an adminpublic java.util.Set<org.apache.directory.api.ldap.model.name.Dn> getGroups(java.lang.String member)
throws org.apache.directory.api.ldap.model.exception.LdapException
member - the member (user) to get the groups fororg.apache.directory.api.ldap.model.exception.LdapException - if there are problems accessing attribute valuespublic boolean groupRenamed(org.apache.directory.api.ldap.model.name.Dn oldName,
org.apache.directory.api.ldap.model.name.Dn newName)