Search in sources :

Example 76 with Attr

use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.

the class PeopleContainer method setMaxUserLimit.

/**
     * Sets max user limit for a People Container.
     * 
     * @param limit
     *            number of users allowed in a People Container
     * @supported.api
     */
public void setMaxUserLimit(long limit) throws UMSException {
    String value = (new Long(limit)).toString();
    setAttribute(new Attr(MAX_USER_ATTR_NAME, value));
}
Also used : Attr(com.iplanet.services.ldap.Attr)

Example 77 with Attr

use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.

the class PersistentObject method readAttributesFromDataStore.

/**
     * Read the attributes from data store
     * 
     * @param attrNames
     *            names of attributes to get
     * @return collection of Attr read from data store
     */
private Collection readAttributesFromDataStore(Collection attrNames) throws UMSException {
    Collection attributes = DataLayer.getInstance().getAttributes(getPrincipal(), getGuid(), attrNames);
    if (attributes == null) {
        String[] args = { getDN() };
        throw new UMSException(i18n.getString(IUMSConstants.READ_ATTRIBUTES_ERROR, args));
    }
    Collection foundAttributes = new ArrayList();
    if (m_attrSet == null) {
        m_attrSet = new AttrSet();
    }
    if (m_nullAttributes == null) {
        m_nullAttributes = new ArrayList();
    }
    Iterator iter = attributes.iterator();
    while (iter.hasNext()) {
        Attr attr = (Attr) iter.next();
        foundAttributes.add(attr.getName());
        m_attrSet.replace(attr);
    }
    iter = attrNames.iterator();
    while (iter.hasNext()) {
        String attrName = (String) iter.next();
        if (!foundAttributes.contains(attrName) && !m_nullAttributes.contains(attrName)) {
            m_nullAttributes.add(attrName);
        }
    }
    return attributes;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Collection(java.util.Collection) ByteString(org.forgerock.opendj.ldap.ByteString) Attr(com.iplanet.services.ldap.Attr) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 78 with Attr

use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.

the class PersistentObject method getACI.

/**
     * Returns all the ACIs of this object with the given name.
     * 
     * @param name Name of the ACI to get.
     * @return collecion of ACIs of this object.
     * @throws ACIParseException in case of any error
     *
     * @supported.api
     */
public Collection getACI(String name) throws ACIParseException, UMSException {
    Collection acis = new ArrayList();
    Attr aciAttr = getAttribute(ACI.ACI);
    if (aciAttr != null) {
        String[] aciTexts = aciAttr.getStringValues();
        int size = aciTexts.length;
        for (int i = 0; i < size; i++) {
            ACI aci = ACI.valueOf(aciTexts[i]);
            if (aci.getName().equals(name)) {
                acis.add(aci);
            }
        }
    }
    return acis;
}
Also used : ACI(com.iplanet.services.ldap.aci.ACI) ArrayList(java.util.ArrayList) Collection(java.util.Collection) ByteString(org.forgerock.opendj.ldap.ByteString) Attr(com.iplanet.services.ldap.Attr)

Example 79 with Attr

use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.

the class PersistentObject method replaceACI.

/**
     * Replaces an ACI of this object
     * 
     * @param oldACI ACI to be replaced.
     * @param newACI the new ACI.
     * @throws AccessRightsException if an access rights exception occurs.
     * @throws UMSException if any error.
     *
     * @supported.api
     */
public void replaceACI(ACI oldACI, ACI newACI) throws AccessRightsException, UMSException {
    Attr attr = new Attr(ACI.ACI, oldACI.getACIText());
    modify(attr, ModificationType.DELETE);
    attr = new Attr(ACI.ACI, newACI.toString());
    modify(attr, ModificationType.ADD);
    save();
}
Also used : Attr(com.iplanet.services.ldap.Attr)

Example 80 with Attr

use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.

the class ManagedRole method removeMember.

/**
     * Removes a member from the role. The change is saved to persistent
     * storage.
     * 
     * @param member
     *            member to be removed from the role
     * @exception UMSException
     *                on failure to save to persistent storage
     * @supported.api
     */
public void removeMember(PersistentObject member) throws UMSException {
    Principal principal = getPrincipal();
    if (principal == null) {
        throw new IllegalArgumentException(i18n.getString(IUMSConstants.BAD_PRINCIPAL_HDL));
    }
    member.modify(new Attr(MEMBER_ATTR_NAME, this.getDN()), ModificationType.DELETE);
    // member.save();
    DataLayer.getInstance().removeAttributeValue(principal, member.getGuid(), MEMBER_ATTR_NAME, this.getDN());
}
Also used : Principal(java.security.Principal) Attr(com.iplanet.services.ldap.Attr)

Aggregations

Attr (com.iplanet.services.ldap.Attr)89 AttrSet (com.iplanet.services.ldap.AttrSet)34 Guid (com.iplanet.ums.Guid)16 Iterator (java.util.Iterator)15 UMSException (com.iplanet.ums.UMSException)14 PersistentObject (com.iplanet.ums.PersistentObject)12 HashSet (java.util.HashSet)12 Set (java.util.Set)12 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)9 Map (java.util.Map)9 ByteString (org.forgerock.opendj.ldap.ByteString)9 AMException (com.iplanet.am.sdk.AMException)7 SSOException (com.iplanet.sso.SSOException)5 AMHashMap (com.iplanet.am.sdk.AMHashMap)4 Enumeration (java.util.Enumeration)4 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)3 AssignableDynamicGroup (com.iplanet.ums.AssignableDynamicGroup)3 CreationTemplate (com.iplanet.ums.CreationTemplate)3 EntryNotFoundException (com.iplanet.ums.EntryNotFoundException)3