@Test public void getEventsForUserAndIPWithoutAdminAccessReturnsEmptyList() { when(this.auth.hasAccess(this.user, Right.ADMIN, this.xwikiPreferences)).thenReturn(false); Assert.assertTrue(this.scriptService.getEventsForUser("user", "ip").isEmpty()); Mockito.verifyZeroInteractions(this.store); }
@Nonnull public List<AuditEvent> getEventsForUser(String userId) { if (this.auth.hasAccess(this.users.getCurrentUser(), Right.ADMIN, this.resolver.resolve(Constants.XWIKI_SPACE_REFERENCE))) { return this.store.getEventsForUser(this.users.getUser(userId)); } return Collections.emptyList(); }
AuditScriptService implements ScriptService { @Nonnull public List<AuditEvent> getEventsForUser(String userId) { if (this.auth.hasAccess(this.users.getCurrentUser(), Right.ADMIN, this.resolver.resolve(Constants.XWIKI_SPACE_REFERENCE))) { return this.store.getEventsForUser(this.users.getUser(userId)); } return Collections.emptyList(); } }
AuditScriptService implements ScriptService { @Nonnull public List<AuditEvent> getEventsForUser(String userId) { if (this.auth.hasAccess(this.users.getCurrentUser(), Right.ADMIN, this.resolver.resolve(Constants.XWIKI_SPACE_REFERENCE))) { return this.store.getEventsForUser(this.users.getUser(userId)); } return Collections.emptyList(); }  }
AuditScriptService implements ScriptService { @Nonnull public List<AuditEvent> getEventsForUser(String userId) { if (this.auth.hasAccess(this.users.getCurrentUser(), Right.ADMIN, this.resolver.resolve(Constants.XWIKI_SPACE_REFERENCE))) { return this.store.getEventsForUser(this.users.getUser(userId)); } return Collections.emptyList(); }  @Nonnull List<AuditEvent> getEventsForEntity(DocumentReference entity); @Nonnull List<AuditEvent> getEventsForUser(String userId); @Nonnull List<AuditEvent> getEventsForUser(String userId, String ip); @Nonnull @SuppressWarnings("checkstyle:ParameterNumber") List<AuditEvent> getEvents(int start, int number, String action, String userId, String ip, String entityId,
        String fromTime, String toTime); long countEvents(String action, String userId, String ip, String entityId, String fromTime, String toTime); }
AuditScriptService implements ScriptService { @Nonnull public List<AuditEvent> getEventsForUser(String userId) { if (this.auth.hasAccess(this.users.getCurrentUser(), Right.ADMIN, this.resolver.resolve(Constants.XWIKI_SPACE_REFERENCE))) { return this.store.getEventsForUser(this.users.getUser(userId)); } return Collections.emptyList(); }  @Nonnull List<AuditEvent> getEventsForEntity(DocumentReference entity); @Nonnull List<AuditEvent> getEventsForUser(String userId); @Nonnull List<AuditEvent> getEventsForUser(String userId, String ip); @Nonnull @SuppressWarnings("checkstyle:ParameterNumber") List<AuditEvent> getEvents(int start, int number, String action, String userId, String ip, String entityId,
        String fromTime, String toTime); long countEvents(String action, String userId, String ip, String entityId, String fromTime, String toTime);  }