コード例 #1
0
  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();
    }
  }
コード例 #2
0
  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
  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);
  }