Search in sources :

Example 1 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class SaveContextPolices method performFunction.

@Override
public ListField<ContextPolicyBin> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(POLICY_MANAGER_PID, new PolicyManagerServiceProperties().contextPoliciesToPolicyManagerProps(contextPolicies.getList()), true);
    OperationReport configReport = configurator.commit("Web Context Policy saved with details: {}", contextPolicies.toString());
    if (configReport.containsFailedResults()) {
        addResultMessage(failedPersistError());
    }
    return containsErrorMsgs() ? null : contextPolicies;
}
Also used : PolicyManagerServiceProperties(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 2 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class SaveWhitelistContexts method performFunction.

@Override
public ListField<ContextPath> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(PolicyManagerServiceProperties.POLICY_MANAGER_PID, new PolicyManagerServiceProperties().whiteListToPolicyManagerProps(contexts), true);
    OperationReport configReport = configurator.commit("Whitelist Contexts saved with details: {}", contexts.toString());
    if (configReport.containsFailedResults()) {
        addResultMessage(failedPersistError());
    }
    return configReport.containsFailedResults() ? null : contexts;
}
Also used : PolicyManagerServiceProperties(org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 3 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class InstallEmbeddedLdap method performFunction.

@Override
public BooleanField performFunction() {
    // TODO: tbatie - 4/4/17 - This should return back the setup config
    Configurator configurator = configuratorFactory.getConfigurator();
    switch(useCase.getValue()) {
        case LOGIN:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_LOGIN_CONFIG_FEATURE);
            break;
        case ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_CLAIMS_HANDLER_CONFIG_FEATURE);
            break;
        case LOGIN_AND_ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(ALL_DEFAULT_EMBEDDED_LDAP_CONFIG_FEATURE);
            break;
        default:
            LOGGER.debug("Unrecognized LDAP use case \"{}\". No commits will be made. ", useCase.getValue());
            // TODO: tbatie - 4/4/17 - change this to specify the arg that was unknown
            addResultMessage(new ErrorMessage("FAILED_PERSIST"));
            return new BooleanField(false);
    }
    OperationReport report = configurator.commit();
    if (report.containsFailedResults()) {
        addResultMessage(new ErrorMessage("CANNOT_INSTALL"));
        return new BooleanField(false);
    }
    return new BooleanField(true);
}
Also used : BooleanField(org.codice.ddf.admin.common.fields.base.scalar.BooleanField) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ErrorMessage(org.codice.ddf.admin.common.report.message.ErrorMessage)

Example 4 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class DeleteLdapConfiguration method performFunction.

@Override
public ListField<LdapConfigurationField> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.deleteManagedService(pid.getValue());
    OperationReport report = configurator.commit("LDAP Configuration deleted for servicePid: {}", pid.getValue());
    // TODO: tbatie - 4/3/17 - Add error reporting here
    return serviceCommons.getLdapConfigurations(configuratorFactory);
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Example 5 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class SaveLdapConfiguration method performFunction.

@Override
public ListField<LdapConfigurationField> performFunction() {
    Configurator configurator = configuratorFactory.getConfigurator();
    if (config.settingsField().useCase().equals(LOGIN) || config.settingsField().useCase().equals(LOGIN_AND_ATTRIBUTE_STORE)) {
        Map<String, Object> ldapLoginServiceProps = serviceCommons.ldapConfigurationToLdapLoginService(config);
        configurator.startFeature(LdapLoginServiceProperties.LDAP_LOGIN_FEATURE);
        configurator.createManagedService(LdapLoginServiceProperties.LDAP_LOGIN_MANAGED_SERVICE_FACTORY_PID, ldapLoginServiceProps);
    }
    if (config.settingsField().useCase().equals(ATTRIBUTE_STORE) || config.settingsField().useCase().equals(LOGIN_AND_ATTRIBUTE_STORE)) {
        Path newAttributeMappingPath = Paths.get(System.getProperty("ddf.home"), "etc", "ws-security", "ldapAttributeMap-" + UUID.randomUUID().toString() + ".props");
        Map<String, Object> ldapClaimsServiceProps = serviceCommons.ldapConfigToLdapClaimsHandlerService(config);
        configurator.createPropertyFile(newAttributeMappingPath, config.settingsField().attributeMap());
        configurator.startFeature(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_FEATURE);
        configurator.createManagedService(LdapClaimsHandlerServiceProperties.LDAP_CLAIMS_HANDLER_MANAGED_SERVICE_FACTORY_PID, ldapClaimsServiceProps);
    }
    OperationReport report = configurator.commit("LDAP Configuration saved with details: {}", config.toString());
    // TODO: tbatie - 4/3/17 - Handle error messages
    return serviceCommons.getLdapConfigurations(configuratorFactory);
}
Also used : Path(java.nio.file.Path) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport)

Aggregations

Configurator (org.codice.ddf.admin.configurator.Configurator)6 OperationReport (org.codice.ddf.admin.configurator.OperationReport)6 PolicyManagerServiceProperties (org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties)2 Path (java.nio.file.Path)1 BooleanField (org.codice.ddf.admin.common.fields.base.scalar.BooleanField)1 ReportImpl (org.codice.ddf.admin.common.report.ReportImpl)1 ErrorMessage (org.codice.ddf.admin.common.report.message.ErrorMessage)1