Package org.opends.server.extensions
Class StaticGroup
java.lang.Object
org.opends.server.extensions.StaticGroup
- All Implemented Interfaces:
Group
A static group implementation, in which the DNs of all members are explicitly listed.
There are three variants of static groups:
- one based on the
groupOfNamesobject class: which stores the member list in thememberattribute - one based on the
groupOfEntriesobject class, which also stores the member list in thememberattribute - one based on the
groupOfUniqueNamesobject class, which stores the member list in theuniqueMemberattribute.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opends.server.api.Group
Group.ExaminedGroups -
Method Summary
Modifier and TypeMethodDescriptiongetAllMembers(Dn baseDN, SearchScope scope, Filter filter) Retrieves an iterator that may be used to cursor through the entries of the members contained in this group, or its nested groups.getEntry()Returns the entry corresponding to this static group.static FilterRetrieves a search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server.Retrieves the DN of the entry that contains the definition for this group.Retrieves an iterator that may be used to cursor through the Dns of the members contained in this group.intReturns the number of members of this group.intReturns an estimate the size of this static group in bytes.static booleanisGroupDefinition(Entry entry) Indicates whether the provided entry contains a valid definition for this type of group.booleanisMember(Dn userDN, Group.ExaminedGroups examinedGroups) Indicates whether the user with the specified DN is a member of this group.booleanisMember(Entry userEntry, Group.ExaminedGroups examinedGroups) Indicates whether the user described by the provided user entry is a member of this group.booleanIndicates whether it is possible to alter the member list for this group (e.g., in order to add members to the group or remove members from it).static StaticGroupnewInstance(ServerContext serverContext, Entry groupEntry) Creates a new group of this type based on the definition contained in the provided entry.voidRecomputes the nested groups for this static group.voidrecomputeNestedGroupsForAddedGroups(Set<Dn> addedGroups) Recomputes the nested groups if at least one of the provided dns is a direct member of this static group i.e.voidrecomputeNestedGroupsForRemovedGroups(Set<Group> removedGroups) Recomputes the nested groups if at least one of the provided groups is nested in this static group.voidRenames this group, and use the provided DN as the new name for this group.toString()voidupdateMembers(Entry newGroupEntry, List<Modification> modifications) Attempt to make multiple changes to the group's member list.booleanupdatesMembers(String modifiedAttributeName) Indicates whether the attribute modification impacts the membership of this group.
-
Method Details
-
getEntry
Returns the entry corresponding to this static group.- Returns:
- the entry corresponding to this static group.
-
newInstance
public static StaticGroup newInstance(ServerContext serverContext, Entry groupEntry) throws LdapException Creates a new group of this type based on the definition contained in the provided entry. It should be noted that the nested groups are initialized with an empty list, and thatrecomputeNestedGroups()can be used to have the nested groups correctly reflecting the groups' hierarchy.- Parameters:
serverContext- The server context.groupEntry- The entry containing the definition for the group to be created.- Returns:
- The group instance created from the definition in the provided entry.
- Throws:
LdapException- If a problem occurs while trying to create the group instance.
-
getGroupDefinitionFilter
Retrieves a search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server.- Returns:
- A search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server.
-
isGroupDefinition
Indicates whether the provided entry contains a valid definition for this type of group.- Parameters:
entry- The entry for which to make the determination.- Returns:
trueif the provided entry does contain a valid definition for this type of group, orfalseif it does not.
-
getGroupDN
Description copied from interface:GroupRetrieves the DN of the entry that contains the definition for this group.- Specified by:
getGroupDNin interfaceGroup- Returns:
- The DN of the entry that contains the definition for this group.
-
rename
Description copied from interface:GroupRenames this group, and use the provided DN as the new name for this group. -
isMember
Description copied from interface:GroupIndicates whether the user with the specified DN is a member of this group. Note that this is a point-in-time determination and the caller must not cache the result. Also note that group implementations that support nesting should use this version of the method rather than the version that does not take a set of DNs when attempting to determine whether a nested group includes the target member.- Specified by:
isMemberin interfaceGroup- Parameters:
userDN- The DN of the user for which to make the determination.examinedGroups- A set of groups that have already been examined in the process of making the determination. This provides a mechanism to prevent infinite recursion due to circular references (e.g., two groups include each other as nested groups). Each time a group instance is checked, its DN should be added to the list, and any DN already contained in the list should be skipped. The use of an atomic reference allow to lazily create the Set to optimize memory when there is no nested groups.- Returns:
trueif the specified user is currently a member of this group, orfalseif not.- Throws:
LdapException- If a problem occurs while attempting to make the determination.
-
isMember
Description copied from interface:GroupIndicates whether the user described by the provided user entry is a member of this group. Note that this is a point-in-time determination and the caller must not cache the result. Also note that group implementations that support nesting should use this version of the method rather than the version that does not take a set of DNs when attempting to determine whether a nested group includes the target member.- Specified by:
isMemberin interfaceGroup- Parameters:
userEntry- The entry for the user for which to make the determination.examinedGroups- A set of groups that have already been examined in the process of making the determination. This provides a mechanism to prevent infinite recursion due to circular references (e.g., two groups include each other as nested groups). Each time a group instance is checked, its DN should be added to the list, and any DN already contained in the list should be skipped. The use of an atomic reference allow to lazily create the Set to optimize memory when there is no nested groups.- Returns:
trueif the specified user is currently a member of this group, orfalseif not.- Throws:
LdapException- If a problem occurs while attempting to make the determination.
-
recomputeNestedGroups
public void recomputeNestedGroups()Recomputes the nested groups for this static group. When groups changes (add/delete/modify/modifyDn) impact the direct members of this static group, the nested groups should be recomputed to reflect the new groups' hierarchy. -
recomputeNestedGroupsForRemovedGroups
Recomputes the nested groups if at least one of the provided groups is nested in this static group.- Parameters:
removedGroups- The set of groups to search in the nested groups.
-
recomputeNestedGroupsForAddedGroups
Recomputes the nested groups if at least one of the provided dns is a direct member of this static group i.e. a value for its member attribute.- Parameters:
addedGroups- The set of dns to search in the direct members of this group.
-
getMemberDns
Description copied from interface:GroupRetrieves an iterator that may be used to cursor through the Dns of the members contained in this group. Note that this is a point-in-time determination, and the caller must not cache the result. Further, the determination should only include this group and not members from nested groups.- Specified by:
getMemberDnsin interfaceGroup- Returns:
- An iterator that may be used to cursor through the entries of the members contained in this group.
-
getAllMembers
Description copied from interface:GroupRetrieves an iterator that may be used to cursor through the entries of the members contained in this group, or its nested groups. It may optionally retrieve a subset of the member entries based on a given set of criteria. Note that this is a point-in-time determination, and the caller must not cache the result.- Specified by:
getAllMembersin interfaceGroup- Parameters:
baseDN- The base DN that should be used when determining whether a given entry will be returned. If this isnull, then all entries will be considered in the scope of the criteria.scope- The scope that should be used when determining whether a given entry will be returned. It must not benullif the provided base DN is notnull. The scope will be ignored if no base DN is provided.filter- The filter that should be used when determining whether a given entry will be returned. If this isnull, then any entry in the scope of the criteria will be included in the results.- Returns:
- An iterator that may be used to cursor through the entries of the members contained in this group.
-
getMembersCount
public int getMembersCount()Returns the number of members of this group.- Returns:
- the number of members of this group.
-
mayAlterMemberList
public boolean mayAlterMemberList()Description copied from interface:GroupIndicates whether it is possible to alter the member list for this group (e.g., in order to add members to the group or remove members from it).- Specified by:
mayAlterMemberListin interfaceGroup- Returns:
trueif it is possible to add members to this group, orfalseif not.
-
updatesMembers
Description copied from interface:GroupIndicates whether the attribute modification impacts the membership of this group.- Specified by:
updatesMembersin interfaceGroup- Parameters:
modifiedAttributeName- the modified attribute name- Returns:
trueif the modified attribute impacts the membership of this group.
-
updateMembers
Description copied from interface:GroupAttempt to make multiple changes to the group's member list.- Specified by:
updateMembersin interfaceGroup- Parameters:
newGroupEntry- The new entry corresponding to the group without virtual attributes.modifications- The list of modifications being made to the group, which may include changes to non-member attributes.
-
getSizeInBytes
public int getSizeInBytes()Returns an estimate the size of this static group in bytes.- Returns:
- An estimate of the size of this static group in bytes.
-
toString
-