Пример #1
0
  @Path("audit/events")
  @DELETE
  public void clearAudit() {
    auth.init(RealmAuth.Resource.AUDIT).requireManage();

    AuditProvider audit = providers.getProvider(AuditProvider.class);
    audit.clear(realm.getId());
  }
Пример #2
0
  @Path("audit/events")
  @GET
  @NoCache
  @Produces(MediaType.APPLICATION_JSON)
  public List<Event> getAudit(
      @QueryParam("client") String client,
      @QueryParam("event") String event,
      @QueryParam("user") String user,
      @QueryParam("ipAddress") String ipAddress,
      @QueryParam("first") Integer firstResult,
      @QueryParam("max") Integer maxResults) {
    auth.init(RealmAuth.Resource.AUDIT).requireView();

    AuditProvider audit = providers.getProvider(AuditProvider.class);

    EventQuery query = audit.createQuery().realm(realm.getId());
    if (client != null) {
      query.client(client);
    }
    if (event != null) {
      query.event(event);
    }
    if (user != null) {
      query.user(user);
    }
    if (ipAddress != null) {
      query.ipAddress(ipAddress);
    }
    if (firstResult != null) {
      query.firstResult(firstResult);
    }
    if (maxResults != null) {
      query.maxResults(maxResults);
    }

    return query.getResultList();
  }