private void onTaskChanged(GwtConversation conversation, Task task, Map properties) {
   // update sprint day snapshot after change
   conversation
       .getProject()
       .getCurrentSprint()
       .getDaySnapshot(Date.today())
       .updateWithCurrentSprint();
   Requirement requirement = task.getRequirement();
   if (requirement.isInCurrentSprint()) {
     User currentUser = conversation.getSession().getUser();
     if (task.isClosed() && properties.containsKey("remainingWork")) {
       String event = currentUser.getName() + " closed " + task.getReferenceAndLabel();
       if (requirement.isTasksClosed()) {
         event += ", all tasks closed in " + requirement.getReferenceAndLabel();
       }
       postProjectEvent(conversation, event, task);
     } else if (task.isOwnerSet() && properties.containsKey("ownerId")) {
       postProjectEvent(
           conversation, currentUser.getName() + " claimed " + task.getReferenceAndLabel(), task);
     }
     if (!task.isOwnerSet() && properties.containsKey("ownerId")) {
       postProjectEvent(
           conversation,
           currentUser.getName() + " unclaimed " + task.getReferenceAndLabel(),
           task);
     }
     if (!task.isClosed() && requirement.isRejectDateSet()) {
       requirement.setRejectDate(null);
       sendToClients(conversation, requirement);
     }
   }
 }
Exemple #2
0
 public final boolean addAuthors(Collection<scrum.server.admin.User> authors) {
   if (authors == null) throw new IllegalArgumentException("authors == null");
   boolean added = false;
   for (scrum.server.admin.User author : authors) {
     added = added | this.authorsIds.add(author.getId());
   }
   return added;
 }
 private void onStartConversation(GwtConversation conversation) {
   User user = conversation.getSession().getUser();
   if (user == null) throw new PermissionDeniedException("Login required.");
   conversation.clearRemoteEntities();
   conversation.getNextData().applicationInfo = webApplication.getApplicationInfo();
   conversation.sendToClient(webApplication.getSystemConfig());
   conversation.getNextData().setUserId(user.getId());
   conversation.sendUserScopeDataToClient(user);
 }
  @Override
  public void onChangePassword(
      GwtConversation conversation, String oldPassword, String newPassword) {
    User user = conversation.getSession().getUser();
    if (!user.matchesPassword(oldPassword)) throw new WrongPasswordException();

    user.setPassword(newPassword);

    log.info("password changed by", user);
  }
 @Override
 public void onResetPassword(GwtConversation conversation, String userId) {
   if (!conversation.getSession().getUser().isAdmin()) throw new PermissionDeniedException();
   User user = userDao.getById(userId);
   if (webApplication.getSystemConfig().isSmtpServerSet() && user.isEmailSet()) {
     user.triggerPasswordReset();
   } else {
     user.setPassword(webApplication.getSystemConfig().getDefaultUserPassword());
   }
 }
Exemple #6
0
 public final boolean addAuthor(scrum.server.admin.User author) {
   if (author == null) throw new IllegalArgumentException("author == null");
   boolean added = this.authorsIds.add(author.getId());
   if (added) updateLastModified();
   if (added) fireModified("authors+=" + author);
   return added;
 }
Exemple #7
0
 public final boolean removeAuthor(scrum.server.admin.User author) {
   if (author == null) throw new IllegalArgumentException("author == null");
   if (this.authorsIds == null) return false;
   boolean removed = this.authorsIds.remove(author.getId());
   if (removed) updateLastModified();
   if (removed) fireModified("authors-=" + author);
   return removed;
 }
  private void onBlogEntryChanged(
      GwtConversation conversation, BlogEntry blogEntry, Map properties) {
    User currentUser = conversation.getSession().getUser();

    if (properties.containsKey("text")) {
      blogEntry.addAuthor(currentUser);
    }

    if (properties.containsKey("published")) {
      if (blogEntry.isPublished()) {
        postProjectEvent(
            conversation,
            currentUser.getName() + " published " + blogEntry.getReferenceAndLabel(),
            blogEntry);
      }
      blogEntry.getProject().updateHomepage();
    }
  }
 private void onImpedimentChanged(
     GwtConversation conversation, Impediment impediment, Map properties) {
   User currentUser = conversation.getSession().getUser();
   if (properties.containsKey("closed")) {
     if (impediment.isClosed()) {
       impediment.setDate(Date.today());
       postProjectEvent(
           conversation,
           currentUser.getName() + " closed " + impediment.getReferenceAndLabel(),
           impediment);
     } else {
       postProjectEvent(
           conversation,
           currentUser.getName() + " reopened " + impediment.getReferenceAndLabel(),
           impediment);
     }
   }
 }
Exemple #10
0
  @Override
  public void onPullStoryToSprint(GwtConversation conversation, String storyId) {
    assertProjectSelected(conversation);
    Requirement story = requirementDao.getById(storyId);
    Project project = conversation.getProject();
    Sprint sprint = project.getCurrentSprint();
    User currentUser = conversation.getSession().getUser();

    sprint.pullRequirement(story, currentUser);

    postProjectEvent(
        conversation,
        currentUser.getName() + " pulled " + story.getReferenceAndLabel() + " to current sprint",
        story);

    sendToClients(conversation, sprint);
    sendToClients(conversation, story);
    sendToClients(conversation, story.getTasksInSprint());
  }
Exemple #11
0
  @Override
  public void onKickStoryFromSprint(GwtConversation conversation, String storyId) {
    assertProjectSelected(conversation);
    Requirement story = requirementDao.getById(storyId);
    Sprint sprint = story.getSprint();
    User currentUser = conversation.getSession().getUser();

    sprint.kickRequirement(story, currentUser);

    postProjectEvent(
        conversation,
        currentUser.getName() + " kicked " + story.getReferenceAndLabel() + " from current sprint",
        story);

    sendToClients(conversation, story.getTasksInSprint());
    sendToClients(conversation, story);
    sendToClients(conversation, sprint);
    sendToClients(conversation, sprint.getProject());
  }
Exemple #12
0
  @Override
  public void onSelectProject(GwtConversation conversation, String projectId) {
    Project project = projectDao.getById(projectId);
    User user = conversation.getSession().getUser();
    if (!project.isVisibleFor(user))
      throw new PermissionDeniedException(
          "Project '" + project + "' is not visible for user '" + user + "'");

    project.setLastOpenedDateAndTime(DateAndTime.now());
    conversation.setProject(project);
    user.setCurrentProject(project);
    ProjectUserConfig config = project.getUserConfig(user);
    config.touch();

    conversation.sendToClient(project);
    conversation.sendToClient(project.getSprints());
    conversation.sendToClient(project.getSprintReports());
    conversation.sendToClient(project.getParticipants());
    for (Requirement requirement : project.getProductBacklogRequirements()) {
      conversation.sendToClient(requirement);
      conversation.sendToClient(requirement.getEstimationVotes());
    }
    for (Requirement requirement : project.getCurrentSprint().getRequirements()) {
      conversation.sendToClient(requirement);
      conversation.sendToClient(requirement.getTasksInSprint());
    }
    conversation.sendToClient(project.getQualitys());
    conversation.sendToClient(project.getUserConfigs());
    conversation.sendToClient(project.getWikipages());
    conversation.sendToClient(project.getImpediments());
    conversation.sendToClient(project.getRisks());
    conversation.sendToClient(project.getLatestProjectEvents(5));
    conversation.sendToClient(project.getCalendarEvents());
    conversation.sendToClient(project.getFiles());
    conversation.sendToClient(project.getOpenIssues());
    conversation.sendToClient(project.getReleases());
    conversation.sendToClient(project.getBlogEntrys());

    sendToClients(conversation, config);
  }
Exemple #13
0
 @Override
 public void onConvertIssueToStory(GwtConversation conversation, String issueId) {
   Issue issue = issueDao.getById(issueId);
   Requirement story = requirementDao.postRequirement(issue);
   issue.appendToStatement("Created Story " + story.getReference() + " in Product Backlog.");
   issue.setCloseDate(Date.today());
   sendToClients(conversation, story);
   sendToClients(conversation, issue);
   User currentUser = conversation.getSession().getUser();
   postProjectEvent(
       conversation,
       currentUser.getName()
           + " created "
           + story.getReference()
           + " from "
           + issue.getReferenceAndLabel(),
       issue);
   changeDao.postChange(issue, currentUser, "storyId", null, story.getId());
   changeDao.postChange(story, currentUser, "issueId", null, issue.getId());
   subscriptionService.copySubscribers(issue, story);
   subscriptionService.notifySubscribers(
       story, "Story created from " + issue, conversation.getProject(), null);
 }
Exemple #14
0
 @Override
 public void onSendIssueReplyEmail(
     GwtConversation conversation,
     String issueId,
     String from,
     String to,
     String subject,
     String text) {
   assertProjectSelected(conversation);
   Issue issue = issueDao.getById(issueId);
   if (Str.isEmail(from)) {
     emailSender.sendEmail(conversation.getProject(), to, subject, text);
   } else {
     emailSender.sendEmail(from, to, subject, text);
   }
   User user = conversation.getSession().getUser();
   postProjectEvent(
       conversation,
       user.getName() + " emailed a response to " + issue.getReferenceAndLabel(),
       issue);
   Change change = changeDao.postChange(issue, user, "@reply", null, text);
   conversation.sendToClient(change);
 }
Exemple #15
0
 public boolean containsParticipantWithVerifiedEmail() {
   for (User user : getParticipants()) {
     if (user.isEmailVerified()) return true;
   }
   return false;
 }
Exemple #16
0
 @Override
 public boolean isDeletableBy(User user) {
   if (user != null && user.isAdmin()) return true;
   return containsAdmin(user);
 }
Exemple #17
0
  private void onRequirementChanged(
      GwtConversation conversation,
      Requirement requirement,
      Map properties,
      Sprint previousRequirementSprint) {
    Project currentProject = conversation.getProject();
    Sprint sprint = requirement.getSprint();
    boolean inCurrentSprint = sprint != null && currentProject.isCurrentSprint(sprint);
    User currentUser = conversation.getSession().getUser();

    if (properties.containsKey("description")
        || properties.containsKey("testDescription")
        || properties.containsKey("qualitysIds")) {
      requirement.setDirty(true);
      conversation.sendToClient(requirement);
    }

    if (properties.containsKey("rejectDate") && requirement.isRejectDateSet()) {
      postProjectEvent(
          conversation,
          currentUser.getName() + " rejected " + requirement.getReferenceAndLabel(),
          requirement);
    }

    if (properties.containsKey("accepted") && requirement.isRejectDateSet()) {
      postProjectEvent(
          conversation,
          currentUser.getName() + " accepted " + requirement.getReferenceAndLabel(),
          requirement);
    }

    if (sprint != previousRequirementSprint) {
      if (properties.containsKey("sprintId")) {
        if (inCurrentSprint) {
          postProjectEvent(
              conversation,
              currentUser.getName()
                  + " pulled "
                  + requirement.getReferenceAndLabel()
                  + " to current sprint",
              requirement);
          subscriptionService.notifySubscribers(
              requirement, "Story pulled to current Sprint", conversation.getProject(), null);
        } else {
          postProjectEvent(
              conversation,
              currentUser.getName()
                  + " kicked "
                  + requirement.getReferenceAndLabel()
                  + " from current sprint",
              requirement);
          subscriptionService.notifySubscribers(
              requirement, "Story kicked from current Sprint", conversation.getProject(), null);
        }
      }
    }

    if (properties.containsKey("estimatedWork")) {
      requirement.initializeEstimationVotes();
      requirement.setDirty(false);
      requirement.setWorkEstimationVotingShowoff(false);
      requirement.setWorkEstimationVotingActive(false);
      conversation.sendToClient(requirement);
    }

    requirement.getProject().getCurrentSprintSnapshot().update();
  }
Exemple #18
0
 public final boolean containsAuthor(scrum.server.admin.User author) {
   if (author == null) return false;
   return this.authorsIds.contains(author.getId());
 }
Exemple #19
0
  private void onIssueChanged(GwtConversation conversation, Issue issue, Map properties) {
    User currentUser = conversation.getSession().getUser();

    if (properties.containsKey("closeDate")) {
      if (issue.isClosed()) {
        issue.setCloseDate(Date.today());
        postProjectEvent(
            conversation, currentUser.getName() + " closed " + issue.getReferenceAndLabel(), issue);
        subscriptionService.notifySubscribers(
            issue, "Issue closed", conversation.getProject(), null);
      } else {
        postProjectEvent(
            conversation,
            currentUser.getName() + " reopened " + issue.getReferenceAndLabel(),
            issue);
        subscriptionService.notifySubscribers(
            issue, "Issue reopened", conversation.getProject(), null);
      }
    }

    if (properties.containsKey("ownerId") && issue.isOwnerSet()) {
      if (!issue.isFixed()) {
        postProjectEvent(
            conversation,
            currentUser.getName() + " claimed " + issue.getReferenceAndLabel(),
            issue);
      }

      Release nextRelease = issue.getProject().getNextRelease();
      if (nextRelease != null && issue.isFixReleasesEmpty()) {
        issue.setFixReleases(Collections.singleton(nextRelease));
      }
    }

    if (properties.containsKey("fixDate")) {
      if (issue.isFixed()) {
        postProjectEvent(
            conversation, currentUser.getName() + " fixed " + issue.getReferenceAndLabel(), issue);
      } else {
        postProjectEvent(
            conversation,
            currentUser.getName() + " rejected fix for " + issue.getReferenceAndLabel(),
            issue);
      }
    }

    if (properties.containsKey("urgent")) {
      if (issue.isBug()) {
        Release currentRelease = issue.getProject().getCurrentRelease();
        if (issue.isAffectedReleasesEmpty() && currentRelease != null) {
          issue.setAffectedReleases(Collections.singleton(currentRelease));
        }
      }
    }

    if (properties.containsKey("acceptDate")) {
      if (issue.isIdea() || issue.isBug()) {
        postProjectEvent(
            conversation,
            currentUser.getName() + " accepted " + issue.getReferenceAndLabel(),
            issue);
        subscriptionService.notifySubscribers(
            issue, "Issue accepted", conversation.getProject(), null);
      }
    }

    issue.getProject().updateHomepage(issue, false);
  }
Exemple #20
0
 @Override
 public boolean isVisibleFor(User user) {
   return (user != null && user.isAdmin()) || containsParticipant(user) || containsAdmin(user);
 }
Exemple #21
0
 @Override
 public void onUpdateSystemMessage(GwtConversation conversation, SystemMessage systemMessage) {
   User user = conversation.getSession().getUser();
   if (user == null || user.isAdmin() == false) throw new PermissionDeniedException();
   webApplication.updateSystemMessage(systemMessage);
 }