Ejemplo n.º 1
0
  /**
   * 사용자를 삭제한다.
   *
   * <p>when 관리자 페이지 사용자 삭제시
   *
   * @param userId the user id
   * @return the result
   * @see {@link Project#isOnlyManager(Long)}
   */
  @Transactional
  public static Result deleteUser(Long userId) {
    if (User.findByLoginId(session().get("loginId")).isSiteManager()) {
      if (Project.isOnlyManager(userId)) {
        flash(Constants.WARNING, "site.userList.deleteAlert");
      } else {
        User user = User.find.byId(userId);
        for (ProjectUser projectUser : user.projectUser) {
          projectUser.delete();
        }
        user.changeState(UserState.DELETED);
      }
    } else {
      flash(Constants.WARNING, "error.auth.unauthorized.waringMessage");
    }

    return redirect(routes.SiteApp.userList(1, null));
  }
Ejemplo n.º 2
0
  public static Result deleteUser(Long userId) {
    if (Project.isOnlyManager(userId).size() == 0) User.find.byId(userId).delete();
    else flash(Constants.WARNING, "site.userList.deleteAlert");

    return redirect(routes.SiteApp.userList(0, null));
  }