public static void project(Long id) {
    Project project = Project.findById(id);

    Long UID = Long.parseLong(Session.current().get("user_id"));
    User u = User.findById(UID);

    if (project.canBeSeenBy(u)) {
      render(project);
    } else {
      projects();
    }
  }
  public static void createproject(String projectname, String projectdescription) {
    if (projectname != null && projectdescription != null) {
      Long id = Long.parseLong(Session.current().get("user_id"));
      User u = User.findById(id);

      Project p = new Project(projectname, projectdescription, u);
      p.save();

      projects();
    } else {
      render();
    }
  }
예제 #3
0
파일: UserApp.java 프로젝트: bluemir/hive
 private static void collectDatum(
     List<Project> projects,
     List<Posting> postings,
     List<Issue> issues,
     List<PullRequest> pullRequests,
     List<Milestone> milestones,
     int daysAgo) {
   // collect all postings, issues, pullrequests and milesotnes that are contained in the projects.
   for (Project project : projects) {
     if (AccessControl.isAllowed(UserApp.currentUser(), project.asResource(), Operation.READ)) {
       postings.addAll(Posting.findRecentlyCreatedByDaysAgo(project, daysAgo));
       issues.addAll(Issue.findRecentlyOpendIssuesByDaysAgo(project, daysAgo));
       pullRequests.addAll(PullRequest.findOpendPullRequestsByDaysAgo(project, daysAgo));
       milestones.addAll(Milestone.findOpenMilestones(project.id));
     }
   }
 }
예제 #4
0
파일: UserApp.java 프로젝트: bluemir/hive
 private static List<Project> collectProjects(String loginId, User user, String[] groupNames) {
   List<Project> projectCollection = new ArrayList<>();
   // collect all projects that are included in the project groups.
   for (String group : groupNames) {
     switch (group) {
       case "own":
         addProjectNotDupped(projectCollection, Project.findProjectsCreatedByUser(loginId, null));
         break;
       case "member":
         addProjectNotDupped(projectCollection, Project.findProjectsJustMemberAndNotOwner(user));
         break;
       case "watching":
         addProjectNotDupped(projectCollection, user.getWatchingProjects());
         break;
     }
   }
   return projectCollection;
 }
  public static void projects() {
    Long id = Long.parseLong(Session.current().get("user_id"));

    User u = User.findById(id);

    List<Project> projects = Project.find("owner = ?", u).fetch();

    render(projects);
  }