Beispiel #1
0
  @Audit
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  @Override
  public void reportSpammersContent(User spammer, User reporter, String comment) {
    if (log.isInfoEnabled()) {
      log.info(
          "Reporting SPAM Abuse on all content of of this spammer: "
              + spammer.getUsername()
              + ". Reporter is: "
              + reporter.getUsername());
    }

    final Date reportDate = new Date();

    Iterable<Document> docs = documentManager.getUserDocuments(spammer, documentStates);
    for (Document document : docs) {
      if (log.isTraceEnabled()) {
        log.trace("Report spam of document: " + document.getDocumentID());
      }
      reportSpam(document, reporter, comment, reportDate);
    }

    Iterable<ForumMessage> messages = forumManager.getUserMessages(spammer);
    for (ForumMessage message : messages) {
      if (log.isTraceEnabled()) {
        log.trace(
            "Report spam of message: "
                + message.getID()
                + ", threadId: "
                + message.getForumThreadID());
      }
      // TODO: Check how works root messages (threads)
      reportSpam(message, reporter, comment, reportDate);
    }

    List<Blog> blogs = blogManager.getExplicitlyEntitledBlogs(spammer);
    for (Blog blog : blogs) {
      if (blog.isUserBlog()) {
        Iterator<BlogPost> blogPosts = blogManager.getBlogPosts(blog);
        while (blogPosts.hasNext()) {
          BlogPost blogPost = blogPosts.next();
          if (log.isTraceEnabled()) {
            log.trace("Report spam for Blog post, id: " + blogPost.getID());
          }
          reportSpam(blogPost, reporter, comment, reportDate);
        }
      }
    }
    Iterator<Favorite> favorites =
        favoriteManager.getUserFavorites(spammer, Sets.newHashSet(externalUrlObjectType));
    while (favorites.hasNext()) {
      Favorite favorite = favorites.next();
      JiveObject favoritedObject = favorite.getObjectFavorite().getFavoritedObject();
      if (log.isTraceEnabled()) {
        log.trace("Report spam Favorite (Bookmark) to external URL: " + favorite.getID());
        log.trace("Favorited object: " + favoritedObject);
      }
      reportSpam(favoritedObject, reporter, comment, reportDate);
    }
  }
Beispiel #2
0
 @Override
 public void disableSpammer(User spammer) {
   if (log.isInfoEnabled()) {
     log.info("Disabling spammer: " + spammer.getUsername());
   }
   userManager.disableUser(spammer);
 }
Beispiel #3
0
 @Override
 public Set<User> getUnapprovedSpammers(User moderator) {
   List<ApprovalWorkflowBean> workflows =
       approvalManager.getUnApprovedWorkflowBeans(
           moderator.getID(), -1, JiveObjectModerator.Type.ABUSE);
   Set<User> users = new HashSet<User>();
   for (ApprovalWorkflowBean approvalWorkflowBean : workflows) {
     try {
       JiveObject jiveObject =
           jiveObjectLoader.getJiveObject(
               (int) approvalWorkflowBean.getTypeID(), approvalWorkflowBean.getObjID());
       if (jiveObject instanceof UserAuthoredObject) {
         if (log.isTraceEnabled()) {
           log.trace(
               "Adding "
                   + ((UserAuthoredObject) jiveObject).getUser().getUsername()
                   + " user from object "
                   + jiveObject);
         }
         users.add(((UserAuthoredObject) jiveObject).getUser());
       }
     } catch (NotFoundException e) {
       log.error("Cannot find object for approval", e);
     }
   }
   return users;
 }
Beispiel #4
0
  @Override
  public boolean canReportSpammer(User user) {
    long points = statusLevelManager.getPointLevel(user);
    if (log.isTraceEnabled()) {
      log.trace("User " + user.getUsername() + " has points: " + points);
    }

    if (points > getReporterMinPoints()) {
      return true;
    }
    return false;
  }
Beispiel #5
0
  @Audit
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  @Override
  public void resolveContentAsSpam(User spammer, User moderator) {
    if (log.isInfoEnabled()) {
      log.info("Resolve SPAM reports on all content of of this user: "******"Resolve Documents");
    Iterable<Document> docs = documentManager.getUserDocuments(spammer, documentStatesToResolve);
    for (Document document : docs) {
      if (log.isTraceEnabled()) {
        log.trace("Resolve Report spam of document: " + document.getDocumentID());
      }
      resolveSpamReport(document, moderator);
    }

    log.debug("Resolve Threads");
    ThreadResultFilter moderationFilter = ThreadResultFilter.createDefaultUserMessagesFilter();
    moderationFilter.setStatus(JiveContentObject.Status.ABUSE_HIDDEN);

    Iterable<ForumMessage> messages = forumManager.getUserMessages(spammer, moderationFilter);
    List<Long> resolvedThreads = new ArrayList<Long>();

    for (ForumMessage message : messages) {
      if (log.isTraceEnabled()) {
        log.trace(
            "Resolve Report spam of message: "
                + message.getID()
                + ", threadId: "
                + message.getForumThreadID());
      }
      ForumThread thread = message.getForumThread();
      if (!resolvedThreads.contains(thread.getID())) {
        resolvedThreads.add(thread.getID());
        if (thread.getUser().getUsername().equals(spammer.getUsername())) {
          if (log.isTraceEnabled()) {
            log.trace("Resolve Report spam of thread: " + thread.getID());
          }
          resolveSpamReport(thread, moderator);
        }
      }
      resolveSpamReport(message, moderator);
    }

    log.debug("Resolve Blogs");
    Iterable<Blog> blogs = blogManager.getExplicitlyEntitledBlogs(spammer);
    for (Blog blog : blogs) {
      if (log.isTraceEnabled()) {
        log.trace("Processing blog: " + blog.getName());
      }
      if (blog.isUserBlog()) {
        Iterator<BlogPost> blogPosts = getBlogPosts(blog, JiveContentObject.Status.ABUSE_HIDDEN);
        while (blogPosts.hasNext()) {
          BlogPost blogPost = blogPosts.next();
          if (log.isTraceEnabled()) {
            log.trace("Resolve Report spam Blog post: " + blogPost.getID());
          }
          resolveSpamReport(blogPost, moderator);
        }
      }
    }

    log.trace("Resolve Bookmarks");
    Iterator<Favorite> favorites =
        favoriteManager.getUserFavorites(spammer, Sets.newHashSet(externalUrlObjectType));
    while (favorites.hasNext()) {
      Favorite favorite = favorites.next();
      JiveObject favoritedObject = favorite.getObjectFavorite().getFavoritedObject();
      if (log.isTraceEnabled()) {
        log.trace("Resolve Report spam Favorite (Bookmark) to external URL: " + favorite.getID());
        log.trace(
            "Favorited object, id: "
                + favoritedObject.getID()
                + ", type: "
                + favoritedObject.getObjectType());
      }
      resolveSpamReport(favoritedObject, moderator);
    }
  }