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;
}
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;
}
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);
}
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);
}
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);
}
Aggregations