Search in sources :

Example 6 with TemplateManager

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);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) FilteredRole(com.iplanet.ums.FilteredRole) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) Attr(com.iplanet.services.ldap.Attr) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 7 with TemplateManager

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);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) PeopleContainer(com.iplanet.ums.PeopleContainer) TemplateManager(com.iplanet.ums.TemplateManager) PeopleContainer(com.iplanet.ums.PeopleContainer) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 8 with TemplateManager

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;
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) TemplateManager(com.iplanet.ums.TemplateManager) COSTemplate(com.iplanet.ums.cos.COSTemplate) Attr(com.iplanet.services.ldap.Attr)

Example 9 with TemplateManager

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);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) DynamicGroup(com.iplanet.ums.DynamicGroup) AssignableDynamicGroup(com.iplanet.ums.AssignableDynamicGroup) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) DynamicGroup(com.iplanet.ums.DynamicGroup) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 10 with TemplateManager

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);
}
Also used : Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) AttrSet(com.iplanet.services.ldap.AttrSet) Guid(com.iplanet.ums.Guid) StaticGroup(com.iplanet.ums.StaticGroup) Attr(com.iplanet.services.ldap.Attr) AttrSet(com.iplanet.services.ldap.AttrSet) CreationTemplate(com.iplanet.ums.CreationTemplate) StaticGroup(com.iplanet.ums.StaticGroup) TemplateManager(com.iplanet.ums.TemplateManager) HashSet(java.util.HashSet)

Aggregations

TemplateManager (com.iplanet.ums.TemplateManager)14 CreationTemplate (com.iplanet.ums.CreationTemplate)13 Guid (com.iplanet.ums.Guid)13 AttrSet (com.iplanet.services.ldap.AttrSet)12 UMSException (com.iplanet.ums.UMSException)4 Attr (com.iplanet.services.ldap.Attr)3 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)2 AMException (com.iplanet.am.sdk.AMException)2 AMOrganizationalUnit (com.iplanet.am.sdk.AMOrganizationalUnit)2 AccessRightsException (com.iplanet.ums.AccessRightsException)2 AssignableDynamicGroup (com.iplanet.ums.AssignableDynamicGroup)2 EntryAlreadyExistsException (com.iplanet.ums.EntryAlreadyExistsException)2 OrganizationalUnit (com.iplanet.ums.OrganizationalUnit)2 PersistentObject (com.iplanet.ums.PersistentObject)2 AMHashMap (com.iplanet.am.sdk.AMHashMap)1 AMUserEntryProcessed (com.iplanet.am.sdk.AMUserEntryProcessed)1 DynamicGroup (com.iplanet.ums.DynamicGroup)1 FilteredRole (com.iplanet.ums.FilteredRole)1 ManagedRole (com.iplanet.ums.ManagedRole)1 PeopleContainer (com.iplanet.ums.PeopleContainer)1