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;
}
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());
}
}
Aggregations