Search in sources :

Example 11 with TemplateManager

use of com.iplanet.ums.TemplateManager 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 12 with TemplateManager

use of com.iplanet.ums.TemplateManager 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)

Example 13 with TemplateManager

use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.

the class SearchFilterManager method getSearchFilterFromTemplate.

static String getSearchFilterFromTemplate(int objectType, String orgDN, String searchTemplateName) {
    SearchTemplate searchTemp = null;
    String filter;
    try {
        String searchTempName = ((searchTemplateName == null) ? getSearchTemplateName(objectType) : searchTemplateName);
        if (searchTempName == null) {
            debug.warning("SearchFilterManager." + "getSearchFilterFromTemplate(): Search template name" + " is null. Unable to retrieve search filter. " + "Returning <empty> value.");
            return "";
        }
        TemplateManager mgr = TemplateManager.getTemplateManager();
        Guid orgGuid = ((orgDN == null) ? null : new Guid(orgDN));
        searchTemp = mgr.getSearchTemplate(searchTempName, orgGuid, TemplateManager.SCOPE_TOP);
    // Get the Original search filter
    // Check to see if the filter starts with "(" and ends with ")"
    // In which case there is no need to add opening and closing braces.
    // otherwise add the opening and closing braces.
    } catch (UMSException ue) {
        if (debug.messageEnabled()) {
            debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Got Exception", ue);
        }
    }
    if (searchTemp != null) {
        filter = searchTemp.getSearchFilter();
    } else {
        // FIXME: Why do we need to make it objectclass=*, can't we send the
        // default filter here?
        filter = "(objectclass=*)";
    }
    if (!filter.startsWith("(") || !filter.endsWith(")")) {
        filter = "(" + filter + ")";
    }
    if (debug.messageEnabled()) {
        if (searchTemp != null) {
            debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() SearchTemplate Name = " + searchTemp.getName() + ", objectType = " + objectType + ", orgDN = " + orgDN + ", Obtained Filter = " + searchTemp.getSearchFilter() + ", Modified Filter = " + filter);
        } else {
            debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Filter = " + filter);
        }
    }
    return filter;
}
Also used : UMSException(com.iplanet.ums.UMSException) SearchTemplate(com.iplanet.ums.SearchTemplate) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid)

Example 14 with TemplateManager

use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.

the class DirectoryServicesImpl method createAssignDynamicGroup.

private void createAssignDynamicGroup(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.ASSIGNABLE_DYNAMIC_GROUP, false);
    AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
    makeNamingFirst(attrSet, getNamingAttribute(AMObject.ASSIGNABLE_DYNAMIC_GROUP), profileName);
    TemplateManager tempMgr = TemplateManager.getTemplateManager();
    CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicAssignableDynamicGroup", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
    attrSet = combineOCs(creationTemp, attrSet);
    AssignableDynamicGroup adgroup = new AssignableDynamicGroup(creationTemp, attrSet);
    adgroup.setSearchFilter("(memberof=" + entryDN + ")");
    adgroup.setSearchScope(SearchScope.WHOLE_SUBTREE.intValue());
    adgroup.setSearchBase(new Guid(orgDN));
    parentObj.addChild(adgroup);
    // Invoke Post processing impls
    callBackHelper.postProcess(token, adgroup.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ASSIGNABLE_DYNAMIC_GROUP, false);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) AssignableDynamicGroup(com.iplanet.ums.AssignableDynamicGroup) AttrSet(com.iplanet.services.ldap.AttrSet)

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