Package org.sylfra.idea.plugins.revu.model

Examples of org.sylfra.idea.plugins.revu.model.User$RoleComparator


    }
  }

  protected boolean isEnabledForReview(@NotNull Review review)
  {
    User user = RevuUtils.getCurrentUser(review);
    Set<User> adminUsers = review.getDataReferential().getUsersByRole(true).get(User.Role.ADMIN);
    return ((!review.isEmbedded())
      && (((adminUsers == null) || (adminUsers.isEmpty())) || ((user != null) && (user.hasRole(User.Role.ADMIN)))));
  }
View Full Code Here


    if ((project != null) && (vFile != null))
    {
      Collection<Review> reviews = RevuUtils.getActiveReviewsForCurrentUser(project);
      for (Review review : reviews)
      {
        User user = RevuUtils.getCurrentUser(review);
        if (user == null)
        {
          continue;
        }

        boolean mayReview = RevuUtils.isActive(review) && user.hasRole(User.Role.REVIEWER);
        if ((mayReview || (user.hasRole(User.Role.ADMIN))))
        {
          enabled = true;
          break;
        }
      }
View Full Code Here

      enabled = false;
    }
    else
    {
      Review review = currentIssue.getReview();
      User user = RevuUtils.getCurrentUser(review);
      enabled = (user != null) &&
        (RevuUtils.isActive(review) && user.hasRole(User.Role.REVIEWER) || (user.hasRole(User.Role.ADMIN)));
    }

    e.getPresentation().setEnabled(enabled);
  }
View Full Code Here

      case LINK:
        review.setExtendedReview(dialog.getImportedReview());
        break;
    }

    User currentUser = RevuUtils.getCurrentUser();
    if (currentUser != null)
    {
      User reviewCurrentUser = review.getDataReferential().getUser(currentUser.getLogin(), false);
      if (reviewCurrentUser == null)
      {
        for (User.Role role : User.Role.values())
        {
          currentUser.addRole(role);
        }
        review.getDataReferential().addUser(currentUser);
      }
      else
      {
        if (!reviewCurrentUser.hasRole(User.Role.ADMIN))
        {
          reviewCurrentUser.addRole(User.Role.ADMIN);
        }
      }
    }

    History history = new History();
View Full Code Here

        message = RevuBundle.message("reviewForm.cantModifyEmbeddedReview.text");
      }
      else
      {
        String currentLogin = RevuUtils.getCurrentUserLogin();
        User user = (currentLogin == null) ? null : data.getDataReferential().getUser(currentLogin, true);
        User.Role role = (user == null) ? null : user.getHigherRole();

        message = RevuBundle.message(
          role == null
            ? "reviewForm.userRole.none.text"
            : "reviewForm.userRole." + role.toString().toLowerCase() + ".text",
View Full Code Here

      enabled = false;
    }
    else
    {
      Review review = currentIssue.getReview();
      User user = RevuUtils.getCurrentUser(review);
      enabled = (user != null) &&
        (RevuUtils.isActive(review) && user.hasRole(User.Role.REVIEWER) || (user.hasRole(User.Role.ADMIN)));
    }

    e.getPresentation().setEnabled(enabled);
  }
View Full Code Here

    }
  }

  protected boolean isEnabledForReview(@NotNull Review review)
  {
    User user = RevuUtils.getCurrentUser(review);
    Set<User> adminUsers = review.getDataReferential().getUsersByRole(true).get(User.Role.ADMIN);
    return ((!review.isEmbedded())
      && (((adminUsers == null) || (adminUsers.isEmpty())) || ((user != null) && (user.hasRole(User.Role.ADMIN)))));
  }
View Full Code Here

      case LINK:
        review.setExtendedReview(dialog.getImportedReview());
        break;
    }

    User currentUser = RevuUtils.getCurrentUser();
    User reviewCurrentUser = review.getDataReferential().getUser(currentUser.getLogin(), false);
    if (reviewCurrentUser == null)
    {
      for (User.Role role : User.Role.values())
      {
        currentUser.addRole(role);
      }
      review.getDataReferential().addUser(currentUser);
    }
    else
    {
      if (!reviewCurrentUser.hasRole(User.Role.ADMIN))
      {
        reviewCurrentUser.addRole(User.Role.ADMIN);
      }
    }

    History history = new History();
    Date now = new Date();
View Full Code Here

    if ((project != null) && (vFile != null))
    {
      Collection<Review> reviews = RevuUtils.getActiveReviewsForCurrentUser(project);
      for (Review review : reviews)
      {
        User user = RevuUtils.getCurrentUser(review);
        if (user == null)
        {
          continue;
        }

        boolean mayReview = RevuUtils.isActive(review) && user.hasRole(User.Role.REVIEWER);
        if ((mayReview || (user.hasRole(User.Role.ADMIN))))
        {
          enabled = true;
          break;
        }
      }
View Full Code Here

          }

          @NotNull
          protected User createDefaultData()
          {
            return new User();
          }
        };
      }
    };
  }
View Full Code Here

TOP

Related Classes of org.sylfra.idea.plugins.revu.model.User$RoleComparator

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.