@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"; } }
// TODO should we fire an event when username/name/email is changed (rare)? private void cacheUserDetails() { if (cachedUsername == null) { cachedUsername = getCredentials().getUsername(); } if (cachedPersonName == null) { HAccount account = accountDAO.getByUsername(cachedUsername); if (account != null) { HPerson person = account.getPerson(); if (person != null) { cachedPersonName = person.getName(); cachedPersonEmail = person.getEmail(); } else { cachedPersonEmail = null; } } else { cachedPersonEmail = null; } } }