Search in sources :

Example 1 with SchemaOperationResult

use of password.pwm.ldap.schema.SchemaOperationResult in project pwm by pwm-project.

the class ConfigGuideServlet method restExtendSchema.

@ActionHandler(action = "extendSchema")
private ProcessStatus restExtendSchema(final PwmRequest pwmRequest) throws IOException, PwmUnrecoverableException {
    final ConfigGuideBean configGuideBean = getBean(pwmRequest);
    try {
        final SchemaOperationResult schemaOperationResult = ConfigGuideUtils.extendSchema(pwmRequest.getPwmApplication(), configGuideBean, true);
        pwmRequest.outputJsonResult(RestResultBean.withData(schemaOperationResult.getOperationLog()));
    } catch (Exception e) {
        final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_UNKNOWN, e.getMessage());
        pwmRequest.outputJsonResult(RestResultBean.fromError(errorInformation, pwmRequest));
        LOGGER.error(pwmRequest, e.getMessage(), e);
    }
    return ProcessStatus.Halt;
}
Also used : ConfigGuideBean(password.pwm.http.bean.ConfigGuideBean) ErrorInformation(password.pwm.error.ErrorInformation) SchemaOperationResult(password.pwm.ldap.schema.SchemaOperationResult) ServletException(javax.servlet.ServletException) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) PwmOperationalException(password.pwm.error.PwmOperationalException) ChaiUnavailableException(com.novell.ldapchai.exception.ChaiUnavailableException) PwmException(password.pwm.error.PwmException) IOException(java.io.IOException)

Example 2 with SchemaOperationResult

use of password.pwm.ldap.schema.SchemaOperationResult in project pwm by pwm-project.

the class LdapSchemaExtendCommand method doCommand.

public void doCommand() throws Exception {
    final String ldapUrl = (String) cliEnvironment.getOptions().get(OPTION_LDAPURL);
    final String bindDN = (String) cliEnvironment.getOptions().get(OPTION_BIND_DN);
    final String bindPW;
    if (cliEnvironment.getOptions().containsKey(OPTION_BIND_PW)) {
        bindPW = (String) cliEnvironment.getOptions().get(OPTION_BIND_PW);
    } else {
        final Console console = System.console();
        console.writer().write("enter " + OPTION_BIND_PW + ":");
        console.writer().flush();
        bindPW = new String(console.readPassword());
    }
    final ChaiProviderFactory chaiProviderFactory = cliEnvironment.getPwmApplication().getLdapConnectionService().getChaiProviderFactory();
    final ChaiProvider chaiProvider = chaiProviderFactory.newProvider(ldapUrl, bindDN, bindPW);
    final SchemaOperationResult operationResult = SchemaManager.extendSchema(chaiProvider);
    final boolean checkOk = operationResult.isSuccess();
    if (checkOk) {
        out("schema extension complete.  all extensions in place = " + checkOk);
    } else {
        out("schema extension did not complete.\n" + operationResult.getOperationLog());
    }
}
Also used : ChaiProvider(com.novell.ldapchai.provider.ChaiProvider) ChaiProviderFactory(com.novell.ldapchai.provider.ChaiProviderFactory) Console(java.io.Console) SchemaOperationResult(password.pwm.ldap.schema.SchemaOperationResult)

Aggregations

SchemaOperationResult (password.pwm.ldap.schema.SchemaOperationResult)2 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)1 ChaiProvider (com.novell.ldapchai.provider.ChaiProvider)1 ChaiProviderFactory (com.novell.ldapchai.provider.ChaiProviderFactory)1 Console (java.io.Console)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 ErrorInformation (password.pwm.error.ErrorInformation)1 PwmException (password.pwm.error.PwmException)1 PwmOperationalException (password.pwm.error.PwmOperationalException)1 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)1 ConfigGuideBean (password.pwm.http.bean.ConfigGuideBean)1