use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createFilteredRole.
private void createFilteredRole(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.FILTERED_ROLE) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.FILTERED_ROLE, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.FILTERED_ROLE), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicFilteredRole", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
if (!attrSet.contains(FilteredRole.FILTER_ATTR_NAME)) {
Attr attr = new Attr(FilteredRole.FILTER_ATTR_NAME, SearchFilterManager.getSearchFilter(AMObject.USER, orgDN));
attrSet.add(attr);
}
FilteredRole frole = new FilteredRole(creationTemp, attrSet);
parentObj.addChild(frole);
// Invoke Post processing impls
callBackHelper.postProcess(token, frole.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.FILTERED_ROLE, false);
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createPeopleContainer.
private void createPeopleContainer(PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.PEOPLE_CONTAINER), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicPeopleContainer", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
com.iplanet.ums.PeopleContainer pc = new PeopleContainer(creationTemp, attrSet);
parentObj.addChild(pc);
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createCOSTemplate.
/**
* create COS Template from attribute set for a service, this will involve
* UMS Creation template for COSTemplate
*
* @param serviceID
* Service name
* @param attrSet
* the attribute set
* @param entryDN
* DN of the role
* @return COSTemplate COS Template created
*/
private COSTemplate createCOSTemplate(String serviceID, AttrSet attrset, String entryDN) throws UMSException {
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate basicCOSTemplate = tempMgr.getCreationTemplate("BasicCOSTemplate", null);
// Now need to add the service object for the "serviceID" to the
// required attribute set of the cos creatation template
// need to use schema manager and service manager (TBD)
// But for now just add "extensibleObject" to it
COSTemplate cosTemplate = new COSTemplate(basicCOSTemplate, "\"" + entryDN + "\"");
cosTemplate.addTemplateAttribute("objectclass", "extensibleObject");
if (debug.messageEnabled()) {
debug.message("DirectoryServicesImpl.newCOSTemplate: cn = " + entryDN + " COSTemplate = " + cosTemplate);
}
int size = attrset.size();
for (int i = 0; i < size; i++) {
Attr attr = attrset.elementAt(i);
cosTemplate.modify(attr, ModificationType.ADD);
}
return cosTemplate;
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createDynamicGroup.
private void createDynamicGroup(SSOToken token, PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
// Invoke the Pre Process plugin
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
String entryDN = getNamingAttribute(AMObject.GROUP) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.DYNAMIC_GROUP, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.DYNAMIC_GROUP), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicDynamicGroup", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
com.iplanet.ums.DynamicGroup dgroup = new com.iplanet.ums.DynamicGroup(creationTemp, attrSet);
String filter = dgroup.getSearchFilter();
if ("(objectClass=*)".equalsIgnoreCase(filter)) {
dgroup.setSearchFilter(SearchFilterManager.getSearchFilter(AMObject.USER, orgDN));
}
dgroup.setSearchScope(SearchScope.WHOLE_SUBTREE.intValue());
dgroup.setSearchBase(new Guid(orgDN));
parentObj.addChild(dgroup);
// Invoke Post processing impls
callBackHelper.postProcess(token, dgroup.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.DYNAMIC_GROUP, false);
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createGroup.
private void createGroup(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.GROUP) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.GROUP, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.GROUP), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicGroup", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
com.iplanet.ums.StaticGroup sgroup = new com.iplanet.ums.StaticGroup(creationTemp, attrSet);
parentObj.addChild(sgroup);
Attr um = attrSet.getAttribute(UNIQUE_MEMBER_ATTRIBUTE);
if (um != null) {
String[] values = um.getStringValues();
Set members = new HashSet();
members.addAll(Arrays.asList(values));
updateUserAttribute(token, members, sgroup.getDN(), true);
}
// Invoke Post processing impls
callBackHelper.postProcess(token, sgroup.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.GROUP, false);
}
Aggregations