Search in sources :

Example 21 with OrganizationConfigManager

use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.

the class SubRealmGroupTest method removeOrganization.

private void removeOrganization() throws Exception {
    SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    Set<AMIdentity> identities = new HashSet<AMIdentity>();
    identities.add(user1);
    identities.add(group1);
    IdRepoUtils.deleteIdentities("/", identities);
    OrganizationConfigManager orgMgr = new OrganizationConfigManager(adminToken, "/");
    orgMgr.deleteSubOrganization(SUB_REALM1, true);
    orgMgr.deleteSubOrganization(SUB_REALM2, true);
    EntitlementConfiguration ec = EntitlementConfiguration.getInstance(adminSubject, "/");
    Map<String, Set<String>> saccMap = ec.getSubjectAttributesCollectorConfiguration("OpenSSO");
    Set<String> tmpSet = saccMap.get("groupMembershipSearchIndexEnabled");
    tmpSet.clear();
    tmpSet.add(origGroupMembershipSearchIndexEnabled);
    ec.setSubjectAttributesCollectorConfiguration("OpenSSO", saccMap);
}
Also used : SSOToken(com.iplanet.sso.SSOToken) Set(java.util.Set) HashSet(java.util.HashSet) AMIdentity(com.sun.identity.idm.AMIdentity) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) HashSet(java.util.HashSet)

Example 22 with OrganizationConfigManager

use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.

the class UserIdRepo method getOrgConfig.

static ServiceConfig getOrgConfig(SSOToken adminToken) throws SMSException, SSOException {
    ServiceConfigManager svcCfgMgr = new ServiceConfigManager(IdConstants.REPO_SERVICE, adminToken);
    ServiceConfig cfg = svcCfgMgr.getOrganizationConfig("", null);
    Map values = new HashMap();
    if (cfg == null) {
        OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(adminToken, "/");
        ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, adminToken);
        ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
        Set attrs = orgSchema.getAttributeSchemas();
        for (Iterator iter = attrs.iterator(); iter.hasNext(); ) {
            AttributeSchema as = (AttributeSchema) iter.next();
            values.put(as.getName(), as.getDefaultValues());
        }
        cfg = orgCfgMgr.addServiceConfig(IdConstants.REPO_SERVICE, values);
    }
    return cfg;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) ServiceConfig(com.sun.identity.sm.ServiceConfig) HashMap(java.util.HashMap) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) HashMap(java.util.HashMap) Map(java.util.Map) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 23 with OrganizationConfigManager

use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.

the class AMIdentityTestBase method deleteRealm.

private void deleteRealm(SSOToken ssoToken, String realm) throws SSOException {
    if ((realm != null) && !realm.equals("/")) {
        String parentRealm = getParentRealm(realm);
        try {
            OrganizationConfigManager orgMgr = new OrganizationConfigManager(ssoToken, parentRealm);
            int idx = realm.lastIndexOf("/");
            orgMgr.deleteSubOrganization(realm.substring(idx + 1), true);
        } catch (SMSException e) {
        //ignore if the sub organization already exists.
        }
        deleteRealm(ssoToken, parentRealm);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager)

Example 24 with OrganizationConfigManager

use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.

the class AMIdentityTestBase method createSubRealm.

private void createSubRealm(SSOToken ssoToken, String realm) throws SSOException, SMSException {
    if ((realm != null) && !realm.equals("/")) {
        String parentRealm = getParentRealm(realm);
        createSubRealm(ssoToken, parentRealm);
        OrganizationConfigManager orgMgr = new OrganizationConfigManager(ssoToken, parentRealm);
        int idx = realm.lastIndexOf("/");
        try {
            orgMgr.createSubOrganization(realm.substring(idx + 1), null);
        } catch (SMSException e) {
        //ignore if the sub organization already exists.
        }
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager)

Example 25 with OrganizationConfigManager

use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.

the class RealmTest method deleteRealm.

@Parameters({ "realm" })
@AfterTest(groups = { "cli-realm", "delete-realm" })
public void deleteRealm(String realm) throws CLIException, SMSException {
    String[] param = { realm };
    entering("deleteRealm", param);
    String[] args = { "delete-realm", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
    CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
    cmdManager.addToRequestQueue(req);
    cmdManager.serviceRequestQueue();
    String parentRealm = RealmUtils.getParentRealm(realm);
    String realmName = RealmUtils.getChildRealm(realm);
    OrganizationConfigManager ocm = new OrganizationConfigManager(getAdminSSOToken(), parentRealm);
    Set results = ocm.getSubOrganizationNames(realmName, false);
    assert (results.isEmpty());
    exiting("deleteRealm");
}
Also used : Set(java.util.Set) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) AfterTest(org.testng.annotations.AfterTest)

Aggregations

OrganizationConfigManager (com.sun.identity.sm.OrganizationConfigManager)144 SMSException (com.sun.identity.sm.SMSException)87 Set (java.util.Set)79 HashSet (java.util.HashSet)54 SSOException (com.iplanet.sso.SSOException)50 Map (java.util.Map)48 HashMap (java.util.HashMap)40 SSOToken (com.iplanet.sso.SSOToken)33 IdRepoException (com.sun.identity.idm.IdRepoException)32 Iterator (java.util.Iterator)28 AMIdentity (com.sun.identity.idm.AMIdentity)23 CLIException (com.sun.identity.cli.CLIException)21 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)20 ServiceConfig (com.sun.identity.sm.ServiceConfig)17 IOutput (com.sun.identity.cli.IOutput)15 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)15 List (java.util.List)10 ForbiddenException (org.forgerock.json.resource.ForbiddenException)9 BadRequestException (org.forgerock.json.resource.BadRequestException)8 InternalServerErrorException (org.forgerock.json.resource.InternalServerErrorException)8