Exemplo n.º 1
0
 @Override
 public void afterOpenIdAuth(OpenIdAuthenticationResult result) {
   if (result.isAuthenticated()) {
     AccountDAO accountDAO = ServiceLocator.instance().getInstance(AccountDAO.class);
     HAccount account = accountDAO.getByCredentialsId(result.getAuthenticatedId());
     if (account == null) {
       account = new HAccount(); // In case an account is not found
     }
     Contexts.getSessionContext().set("obsoleteAccount", account); // Outject
     // the
     // account
   }
 }
 @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";
   }
 }
Exemplo n.º 3
0
 // 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;
     }
   }
 }
Exemplo n.º 4
0
 public List<HAccount> search(Object input) {
   String userInput = (String) input;
   return accountDAO.searchQuery(userInput);
 }
Exemplo n.º 5
0
 public List<HAccount> search(Object input) {
   this.person = null;
   String userInput = (String) input;
   return accountDAO.searchQuery(userInput);
 }