Package ru.org.linux.user

Examples of ru.org.linux.user.User


    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();

    Poll poll = pollDao.getCurrentPoll();
    Topic msg = messageDao.getById(poll.getTopicId());

    if (voteid != poll.getId()) {
View Full Code Here


    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("нет авторизации");
    }

    User user = tmpl.getCurrentUser();
    user.checkBlocked();
    user.checkAnonymous();

    Comment comment = commentService.getById(msgid);

    if (comment.isDeleted()) {
      throw new UserErrorException("комментарий уже удален");
    }

    Topic topic = messageDao.getById(comment.getTopicId());

    final boolean haveAnswers = commentService.isHaveAnswers(comment);

    if (!permissionService.isCommentDeletableNow(comment, user, topic, haveAnswers)) {
      throw new UserErrorException("комментарий нельзя удалить");
    }

    if (!user.isModerator() || comment.getUserid() == user.getId()) {
      bonus = 0;
    }

    List<Integer> deleted;

    if (user.isModerator()) {
      deleted = commentService.deleteWithReplys(topic, comment, reason, user, bonus);
    } else {
      if (commentService.deleteComment(msgid, reason, user)) {
        deleted = ImmutableList.of(msgid);
      } else {
View Full Code Here

    HttpServletRequest request,
    @ModelAttribute("ipBlockInfo") IPBlockInfo ipBlockInfo
  ) throws Exception {
    Map<String, Object> formParams = new HashMap<>();

    User user = commentService.getCommentUser(commentRequest, request, errors);

    commentService.checkPostData(commentRequest, user, ipBlockInfo, request, errors);
    commentService.prepareReplyto(commentRequest, formParams, request);

    String msg = commentService.getCommentBody(commentRequest, user, errors);
View Full Code Here

  @RequestMapping("/show-comments.jsp")
  public RedirectView showComments(
          @RequestParam String nick
  ) throws Exception {
    User user = userDao.getUser(nick);

    return new RedirectView("search.jsp?range=COMMENTS&user="+user.getNick()+"&sort=DATE");
  }
View Full Code Here

      throw new AccessViolationException("Not moderator");
    }

    ModelAndView mv = new ModelAndView("deleted-comments");

    User user = userDao.getUser(nick);

    mv.getModel().put("user", user);

    mv.getModel().put("deletedList", commentService.getDeletedComments(user));
View Full Code Here

    return !childs.isEmpty();
  }

  public void hideAnonymous(UserDao userDao, Set<Integer> hideSet) throws SQLException, UserNotFoundException {
    if (comment!=null) {
      User commentAuthor = userDao.getUserCached(comment.getUserid());

      if (commentAuthor.isAnonymousScore()) {
        hideNode(hideSet);
      }
    }

    if (comment==null || !hideSet.contains(comment.getId())) {
View Full Code Here

  public String getStyle() {
    return getTheme().getId();
  }

  public Theme getTheme() {
    User user = getCurrentUser();

    if (user == null) {
      return DefaultProfile.getDefaultTheme();
    } else {
      return DefaultProfile.getTheme(user.getStyle());
    }
  }
View Full Code Here

  /**
   * Get current authorized users nick
   * @return nick or null if not authorized
   */
  public String getNick() {
    User currentUser = getCurrentUser();

    if (currentUser==null) {
      return null;
    } else {
      return currentUser.getNick();
    }
  }
View Full Code Here

    @ModelAttribute("ipBlockInfo") IPBlockInfo ipBlockInfo
  ) throws Exception {

    Map<String, Object> formParams = new HashMap<>();

    User user = commentService.getCommentUser(add, request, errors);

    commentService.checkPostData(add, user, ipBlockInfo, request, errors);
    commentService.prepareReplyto(add, formParams, request);

    String msg = commentService.getCommentBody(add, user, errors);
View Full Code Here

  public static void updateLastLogin(Authentication authentication, UserDao userDao) {
    if (authentication != null && (authentication.isAuthenticated())) {
      Object principal = authentication.getPrincipal();
      if (principal instanceof UserDetailsImpl) {
        UserDetailsImpl userDetails = (UserDetailsImpl) principal;
        User user = userDetails.getUser();
        userDao.updateLastlogin(user, true);
      }
    }
  }
View Full Code Here

TOP

Related Classes of ru.org.linux.user.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.