Search in sources :

Example 61 with RestResultBean

use of password.pwm.ws.server.RestResultBean in project pwm by pwm-project.

the class AdminServlet method processClearIntruderTable.

@ActionHandler(action = "clearIntruderTable")
private ProcessStatus processClearIntruderTable(final PwmRequest pwmRequest) throws ChaiUnavailableException, PwmUnrecoverableException, IOException, ServletException {
    if (!pwmRequest.getPwmSession().getSessionManager().checkPermission(pwmRequest.getPwmApplication(), Permission.PWMADMIN)) {
        LOGGER.info(pwmRequest, "unable to execute clear intruder records");
        return ProcessStatus.Halt;
    }
    // pwmApplication.getIntruderManager().clear();
    final RestResultBean restResultBean = RestResultBean.forSuccessMessage(pwmRequest, Message.Success_Unknown);
    pwmRequest.outputJsonResult(restResultBean);
    return ProcessStatus.Halt;
}
Also used : RestResultBean(password.pwm.ws.server.RestResultBean)

Example 62 with RestResultBean

use of password.pwm.ws.server.RestResultBean in project pwm by pwm-project.

the class AdminServlet method processReportStatus.

@ActionHandler(action = "reportStatus")
private ProcessStatus processReportStatus(final PwmRequest pwmRequest) throws ChaiUnavailableException, PwmUnrecoverableException, IOException {
    try {
        final ReportStatusBean returnMap = ReportStatusBean.makeReportStatusData(pwmRequest.getPwmApplication().getReportService(), pwmRequest.getPwmSession().getSessionStateBean().getLocale());
        final RestResultBean restResultBean = RestResultBean.withData(returnMap);
        pwmRequest.outputJsonResult(restResultBean);
    } catch (LocalDBException e) {
        throw new PwmUnrecoverableException(e.getErrorInformation());
    }
    return ProcessStatus.Halt;
}
Also used : PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) LocalDBException(password.pwm.util.localdb.LocalDBException) RestResultBean(password.pwm.ws.server.RestResultBean)

Example 63 with RestResultBean

use of password.pwm.ws.server.RestResultBean in project pwm by pwm-project.

the class AdminServlet method restSessionDataHandler.

@ActionHandler(action = "sessionData")
private ProcessStatus restSessionDataHandler(final PwmRequest pwmRequest) throws ChaiUnavailableException, PwmUnrecoverableException, IOException {
    final int max = readMaxParameter(pwmRequest, 1000, 10 * 1000);
    final ArrayList<SessionStateInfoBean> gridData = new ArrayList<>();
    int counter = 0;
    final Iterator<SessionStateInfoBean> infos = pwmRequest.getPwmApplication().getSessionTrackService().getSessionInfoIterator();
    while (counter < max && infos.hasNext()) {
        gridData.add(infos.next());
        counter++;
    }
    final RestResultBean restResultBean = RestResultBean.withData(gridData);
    pwmRequest.outputJsonResult(restResultBean);
    return ProcessStatus.Halt;
}
Also used : ArrayList(java.util.ArrayList) SessionStateInfoBean(password.pwm.bean.pub.SessionStateInfoBean) RestResultBean(password.pwm.ws.server.RestResultBean)

Aggregations

RestResultBean (password.pwm.ws.server.RestResultBean)63 ErrorInformation (password.pwm.error.ErrorInformation)27 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)21 UserIdentity (password.pwm.bean.UserIdentity)16 PwmException (password.pwm.error.PwmException)16 HelpdeskProfile (password.pwm.config.profile.HelpdeskProfile)15 Instant (java.time.Instant)14 PwmOperationalException (password.pwm.error.PwmOperationalException)14 HashMap (java.util.HashMap)11 LinkedHashMap (java.util.LinkedHashMap)11 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)10 IOException (java.io.IOException)10 PwmApplication (password.pwm.PwmApplication)10 PwmSession (password.pwm.http.PwmSession)10 ConfigManagerBean (password.pwm.http.bean.ConfigManagerBean)9 ArrayList (java.util.ArrayList)8 ServletException (javax.servlet.ServletException)8 UserInfo (password.pwm.ldap.UserInfo)8 AuditRecordFactory (password.pwm.svc.event.AuditRecordFactory)8 HelpdeskAuditRecord (password.pwm.svc.event.HelpdeskAuditRecord)8