XMLRepo repo = XMLRepo.instance(pageContext);
String uid = request.getParameter("uid");
String pid = request.getParameter("pid");
boolean ismgr = !"false".equals(request.getParameter("ismgr"));
if ((uid != null) && (pid != null)) {
Project project = (Project)repo.get(new Project(pid), false);
User user = (User)repo.get(new User(uid), false);
if (project != null && user != null) {
if (ismgr && !project.isManager(user)) {
project.addManager(user);
repo.save(project);
out.print("success");
return;
}
else if (!ismgr && project.isManager(user)) {
project.removeManager(user);
repo.save(project);
out.print("success");
return;
}
}
}
failed