@Restrict("#{s:hasPermission(versionGroupMaintainerManageAction.group,'update')}") public void deleteMaintainer(HPerson person) { log.debug("try to delete maintainer {0} from slug {1}", person.getName(), this.slug); HIterationGroup iterationGroup = versionGroupServiceImpl.getBySlug(this.slug); Set<HPerson> personList = iterationGroup.getMaintainers(); for (HPerson l : personList) { if (l.getEmail().equals(person.getEmail())) { log.debug("remove the person"); iterationGroup.getMaintainers().remove(l); break; } } versionGroupServiceImpl.makePersistent(iterationGroup); versionGroupServiceImpl.flush(); }
@Restrict("#{s:hasPermission(versionGroupMaintainerManageAction.group,'update')}") public String addMaintainers(String account) { HAccount a = accountDAO.getByUsername(account); if (a == null) { FacesMessages.instance().add("This account does not exist."); return "failure"; } else if (a.isEnabled()) { HIterationGroup iterationGroup = versionGroupServiceImpl.getBySlug(this.slug); Set<HPerson> personList = iterationGroup.getMaintainers(); personList.add(a.getPerson()); versionGroupServiceImpl.makePersistent(iterationGroup); versionGroupServiceImpl.flush(); log.debug("add {0} into maintainers", account); return "success"; } else { FacesMessages.instance().add("This account is disabled."); return "failure"; } }