コード例 #1
0
ファイル: MapMembers.java プロジェクト: OurMap/OurMap
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    EasyDelegate del = (EasyDelegate) session.getAttribute(Constantes.DELEGATE);
    User principal = (User) session.getAttribute(Constantes.USER);

    Integer mapid = SigarUtils.parseInt(request.getParameter("mapid"));
    if (mapid == null) mapid = (Integer) request.getAttribute("mapid");
    request.setAttribute("mapid", mapid);

    Map m = del.getMap(mapid);
    Project p = del.getProject(m.getProjectId());

    // Check for consistency BEFORE checking for permissions
    del.checkProjectConsistency(p);

    ReturnMessage r =
        del.hasPermission(principal, "map-creator-owner", mapid, com.bnmi.ourmap.Constantes.MAP);
    if (!r.isSuccess()) throw new SecurityIssue(r.getMessage());

    request.setAttribute("map", m);
    request.setAttribute("project", p);

    // Get map members
    List<String> membersList = del.getMapMembers(mapid);
    List<String> ownersList = del.getMapOwners(mapid);
    List<User> members = del.getUsers(membersList);
    List<User> owners = del.getUsers(ownersList);

    CriteriosUser findAdminStudent = new CriteriosUser();
    findAdminStudent.setNotOverlord(true);
    List<User> potentialUsers = del.getProjectMembers(p.getId());
    // del.get

    request.setAttribute("members", members);
    request.setAttribute("owners", owners);
    request.setAttribute("allUsers", potentialUsers);

    return mapping.findForward("mapmembers");
  }