Esempio n. 1
0
  public void stopImpersonating() {
    if (impersonatingAuthUser.isPresent()) {
      User impUser = impersonatingAuthUser.get().getUser();

      User originalUser = getUser();
      logAndAuditStopImpersonation(originalUser, impUser);

      impersonatingAuthUser = Optional.absent();
    }

    clearUserSelectedReportCriteria();
  }
Esempio n. 2
0
  public void impersonateUser(User userToImpersonate) throws UnauthorizedToImpersonateException {
    boolean allowedToImpersonate = allowedToImpersonate(userToImpersonate);

    if (!allowedToImpersonate) {
      throw new UnauthorizedToImpersonateException();
    }

    User originalUser = getUser();

    impersonatingAuthUser = Optional.of(new AuthUser(userToImpersonate));

    clearUserSelectedReportCriteria();

    logAndAuditImpersonation(originalUser);
  }