Class ManagedRole

  • All Implemented Interfaces:
    IAssignableMembership, IMembership, IRole, ISearch, IUMSConstants, Serializable

    public class ManagedRole
    extends BaseRole
    implements IAssignableMembership
    ManagedRole is a role implementation of the membership interface IAssignableMembership. ManagedRole maps to nsManagedRoleDefinition of iPlanet Directory Server. Member objects added to the role should allow nsRoleDN attribute. When a member is added to the role, the DN of the role is added to the member's nsRoleDN attribute. When a member is removed from the role, the DN of the role is removed from the member's nsRoleDN attribute value.
    See Also:
    Serialized Form
    • Field Detail

      • MEMBER_ATTR_NAME

        public static final String MEMBER_ATTR_NAME
        Name of the member attribute, which is modified when the member is added to/removed from the role. To be added as a member of the role, the member object should allow this attribute.
        See Also:
        Constant Field Values
      • COMPUTED_MEMBER_ATTR_NAME

        public static final String COMPUTED_MEMBER_ATTR_NAME
        Name of the computed member attribute, which would be computed by Directory server for role, when the member entry is read.
        See Also:
        Constant Field Values
      • MANAGEDROLE_OBJECTCLASSES

        public static final String[] MANAGEDROLE_OBJECTCLASSES
        LDAP object classes that define the nsManagedRoleDefinition, the iPlanet Directory Server object class, that maps to ManagedRole
      • MANAGEDROLE_ATTRIBUTES

        public static final String[] MANAGEDROLE_ATTRIBUTES
        The attribute that is must for ManagedRole. Any creation template for ManagedRole should have this attribute
    • Constructor Detail

      • ManagedRole

        public ManagedRole()
        No argument constructor
      • ManagedRole

        public ManagedRole​(CreationTemplate template,
                           AttrSet attrSet)
                    throws UMSException
        Constructs a ManagedRole object in memory with a given template. One needs to call save method to save the new object to persistent storage.
        Parameters:
        template - Template for creating a group
        attrSet - Attribute/value set
        Throws:
        UMSException - on failure to instantiate
    • Method Detail

      • addMember

        public void addMember​(Guid guid)
                       throws UMSException
        Adds a member to the role. The change is saved to persistent storage.
        Specified by:
        addMember in interface IAssignableMembership
        Parameters:
        guid - Globally unique identifier for the member to be added.
        Throws:
        UMSException - if fail to save to persistent storage.
      • addMembers

        public void addMembers​(Guid[] guids)
                        throws UMSException
        Adds a list of members to the role. The change is saved to persistent storage.
        Specified by:
        addMembers in interface IAssignableMembership
        Parameters:
        guids - Array of member guids to be added as members to the role
        Throws:
        UMSException - on failure to save to persistent storage
      • getMemberIDs

        protected SearchResults getMemberIDs​(String[] attributes)
                                      throws UMSException
        Gets the members of the role.
        Parameters:
        attributes - Attributes to return
        Returns:
        SearchResults to iterate over members of the role
        Throws:
        UMSException - on failure to search
      • getMemberIDs

        public SearchResults getMemberIDs​(String filter)
                                   throws UMSException
        Returns the members of the group meeting the filter condition.
        Parameters:
        filter - LDAP filter to select a subset of members
        Returns:
        SearchResults that can be used to iterate over the unique identifiers for members of the role.
        Throws:
        UMSException - if fail to search.
      • getMemberIDAt

        public Guid getMemberIDAt​(int index)
                           throws UMSException
        Gets the GUID of the member at the given index (zero-based).
        Specified by:
        getMemberIDAt in interface IMembership
        Parameters:
        index - Zero-based index into the group container
        Returns:
        Unique identifier for a member
        Throws:
        UMSException - on failure to search
      • removeMember

        public void removeMember​(Guid guid)
                          throws UMSException
        Removes a member from the group. The change is saved to persistent storage.
        Specified by:
        removeMember in interface IAssignableMembership
        Parameters:
        guid - Unique identifier for the member to be removed
        Throws:
        UMSException - on failure to save to persistent storage
      • hasMember

        public boolean hasMember​(Guid guid)
                          throws UMSException
        Checks if a given identifier is a member of the role.
        Specified by:
        hasMember in interface IMembership
        Parameters:
        guid - guid of the member to be checked for membership
        Returns:
        true if it is a member
        Throws:
        UMSException - on failure to read object for guid