Search in sources :

Example 46 with AttrSet

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

the class DirectoryServicesImpl method setDCTreeAttributes.

// TODO: Need to see if the split attributes to a another way of doing
// this instead of passing an array. Need to see if the domain status can
// also be set along with other attributes. Also DCTree code needs to use
// Maps instead of attrSet.
private Map setDCTreeAttributes(SSOToken token, String entryDN, Map attributes, int objectType) throws AMException, SSOException {
    if (objectType == AMObject.ORGANIZATION && dcTreeImpl.isRequired() && !entryDN.equals(AMStoreConnection.getAMSdkBaseDN())) {
        AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
        String status = attrSet.getValue(INET_DOMAIN_STATUS_ATTRIBUTE);
        if (status != null) {
            dcTreeImpl.updateDomainStatus(token, entryDN, status);
        }
        // split up the attrs to be set on DC node and organization node.
        AttrSet[] attrArray = dcTreeImpl.splitAttrSet(entryDN, attrSet);
        attrSet = attrArray[0];
        attributes = CommonUtils.attrSetToMap(attrSet);
        AttrSet domAttrSet = attrArray[1];
        dcTreeImpl.setDomainAttributes(token, entryDN, domAttrSet);
    }
    return attributes;
}
Also used : AttrSet(com.iplanet.services.ldap.AttrSet)

Example 47 with AttrSet

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

the class ComplianceServicesImpl method verifyAndGetAttributes.

/**
     * Method which adds additional compliance required attributes to the
     * existing list of attribute names and then fetches the attribute set from
     * LDAP. The compliance attributes are verified for "inetuserstatus"
     * attribute.
     * <p>
     * 
     * @param po a PersistentObject of the entry.
     * @param attributeNames Array of attribute names.
     * @throws AMException if the fetched attribute names has inetuserstatus
     *         attribute and the value of which is "deleted" or if unable to
     *         fetch the attribute set.
     */
protected AttrSet verifyAndGetAttributes(PersistentObject po, String[] attributeNames) throws AMException {
    // The only thing to verify for compliance is "deleted user". Hence,
    // fetch additional attribute "inetuserstatus" along with the given
    // attributes
    boolean found = false;
    // Check if "intetuserstatus" attribute already exists in request
    int i = 0;
    int numAttrs = attributeNames.length;
    String[] fetchAttributes = new String[numAttrs + 1];
    for (; i < numAttrs; i++) {
        if (attributeNames[i].equalsIgnoreCase(USER_STATUS_ATTRIBUTE)) {
            found = true;
            break;
        } else {
            fetchAttributes[i] = attributeNames[i];
        }
    }
    if (// Add "inetuserstatus" attribute
    !found)
        fetchAttributes[i] = USER_STATUS_ATTRIBUTE;
    else
        // use the original list of attr names
        fetchAttributes = attributeNames;
    // Fetch the attribute,value pairs
    AttrSet retAttrSet;
    try {
        retAttrSet = po.getAttributes(fetchAttributes);
    } catch (UMSException ue) {
        debug.error("Compliance.verifyAndGetAttributes(): ", ue);
        throw new AMException(AMSDKBundle.getString("330"), "330");
    }
    // Verify for deleted user
    verifyAttributes(retAttrSet);
    if (!found) {
        retAttrSet.remove(USER_STATUS_ATTRIBUTE);
    }
    return retAttrSet;
}
Also used : UMSException(com.iplanet.ums.UMSException) AMException(com.iplanet.am.sdk.AMException) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 48 with AttrSet

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

the class DirectoryServicesImpl method createCOSDefinition.

/**
     * Create a COS Definition based on serviceID & attribute set & type. For
     * policy attribute, will set cosattribute to "override" For other
     * attribute, will set cosattribute to "default"
     */
private DirectCOSDefinition createCOSDefinition(String serviceID, Set attrNames) throws UMSException {
    // new attribute set
    AttrSet attrs = new AttrSet();
    // set naming attribute to the serviceID
    Attr attr = new Attr(ICOSDefinition.DEFAULT_NAMING_ATTR, serviceID);
    attrs.add(attr);
    // add cosspecifier
    attr = new Attr(ICOSDefinition.COSSPECIFIER, "nsrole");
    attrs.add(attr);
    // add cosattribute
    attr = new Attr(ICOSDefinition.COSATTRIBUTE);
    Iterator iter = attrNames.iterator();
    while (iter.hasNext()) {
        String attrName = (String) iter.next();
        attr.addValue(attrName);
    }
    attrs.add(attr);
    return new DirectCOSDefinition(attrs);
}
Also used : DirectCOSDefinition(com.iplanet.ums.cos.DirectCOSDefinition) Iterator(java.util.Iterator) Attr(com.iplanet.services.ldap.Attr) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 49 with AttrSet

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

the class DirectoryServicesImpl method createResource.

private void createResource(PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
    AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
    makeNamingFirst(attrSet, getNamingAttribute(AMObject.RESOURCE), profileName);
    TemplateManager tempMgr = TemplateManager.getTemplateManager();
    String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
    CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicResource", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
    com.iplanet.ums.Resource resource = new com.iplanet.ums.Resource(creationTemp, attrSet);
    parentObj.addChild(resource);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 50 with AttrSet

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

the class DirectoryServicesImpl method createRole.

private void createRole(SSOToken token, PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
    // Invoke the Pre Processing plugin
    String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
    String entryDN = getNamingAttribute(AMObject.ROLE) + "=" + profileName + "," + parentObj.getDN();
    attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
    AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
    makeNamingFirst(attrSet, getNamingAttribute(AMObject.ROLE), profileName);
    TemplateManager tempMgr = TemplateManager.getTemplateManager();
    CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicManagedRole", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
    attrSet = combineOCs(creationTemp, attrSet);
    com.iplanet.ums.ManagedRole role = new com.iplanet.ums.ManagedRole(creationTemp, attrSet);
    parentObj.addChild(role);
    // Invoke Post processing impls
    callBackHelper.postProcess(token, role.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) ManagedRole(com.iplanet.ums.ManagedRole) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet) ManagedRole(com.iplanet.ums.ManagedRole)

Aggregations

AttrSet (com.iplanet.services.ldap.AttrSet)61 Attr (com.iplanet.services.ldap.Attr)33 Guid (com.iplanet.ums.Guid)19 Iterator (java.util.Iterator)16 Set (java.util.Set)14 UMSException (com.iplanet.ums.UMSException)13 AMException (com.iplanet.am.sdk.AMException)12 CreationTemplate (com.iplanet.ums.CreationTemplate)12 TemplateManager (com.iplanet.ums.TemplateManager)12 HashMap (java.util.HashMap)9 HashSet (java.util.HashSet)9 Map (java.util.Map)9 ArrayList (java.util.ArrayList)8 PersistentObject (com.iplanet.ums.PersistentObject)6 SSOException (com.iplanet.sso.SSOException)5 AMHashMap (com.iplanet.am.sdk.AMHashMap)4 AssignableDynamicGroup (com.iplanet.ums.AssignableDynamicGroup)4 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)3 AccessRightsException (com.iplanet.ums.AccessRightsException)3 EntryAlreadyExistsException (com.iplanet.ums.EntryAlreadyExistsException)3