private List<String> getUrisFromUserAccounts(Collection<UserAccount> proxyUsers) { List<String> list = new ArrayList<String>(); for (UserAccount u : proxyUsers) { list.add(u.getUri()); } return list; }
private String assembleUserAccountLabel(UserAccount ua) { String last = ua.getLastName(); String first = ua.getFirstName(); if (last.isEmpty()) { return first; } else if (first.isEmpty()) { return last; } else { return last + ", " + first; } }
/** Is there an Individual associated with this user? */ private String getAssociatedIndividualUri() { UserAccount userAccount = LoginStatusBean.getCurrentUser(request); if (userAccount == null) { log.debug("Not logged in? Must be cancelling the password change"); return null; } List<String> uris = Authenticator.getInstance(request).getAssociatedIndividualUris(userAccount); if (uris.isEmpty()) { log.debug("'" + userAccount.getEmailAddress() + "' is not associated with an individual."); return null; } else { String uri = uris.get(0); log.debug("'" + userAccount.getEmailAddress() + "' is associated with an individual: " + uri); return uri; } }
public void updateAccount() { userAccount.setEmailAddress(emailAddress); userAccount.setFirstName(firstName); userAccount.setLastName(lastName); Individual profilePage = getProfilePage(userAccount); if (profilePage != null) { userAccountsDao.setProxyAccountsOnProfile(profilePage.getURI(), proxyUris); } strategy.setAdditionalProperties(userAccount); userAccountsDao.updateUserAccount(userAccount); strategy.notifyUser(); confirmationCode = strategy.getConfirmationCode(); }
public static String createProfile( IndividualDao indDao, DataPropertyStatementDao dpsDao, String profileClassUri, UserAccount account) throws InsertException { IndividualImpl i = new IndividualImpl(); i.setVClassURI(profileClassUri); String indUri = indDao.insertNewIndividual(i); addProp(dpsDao, indUri, URI_FOAF_FIRST_NAME, account.getFirstName()); addProp(dpsDao, indUri, URI_FOAF_LAST_NAME, account.getLastName()); String label = account.getLastName() + ", " + account.getFirstName(); addProp(dpsDao, indUri, VitroVocabulary.LABEL, label); return indUri; }
public final ResponseValues showPage() { Map<String, Object> body = new HashMap<String, Object>(); if (isSubmit()) { body.put("emailAddress", emailAddress); body.put("firstName", firstName); body.put("lastName", lastName); body.put("proxies", buildOngoingProxyList()); } else { body.put("emailAddress", userAccount.getEmailAddress()); body.put("firstName", userAccount.getFirstName()); body.put("lastName", userAccount.getLastName()); body.put("proxies", buildOriginalProxyList()); } body.put("formUrls", buildUrlsMap()); body.put("myAccountUri", userAccount.getUri()); body.put("profileTypes", buildProfileTypesString()); // Could I do this without exposing this mechanism? But how to search // for an associated profile in AJAX? body.put("matchingProperty", SelfEditingConfiguration.getBean(vreq).getMatchingPropertyUri()); if (userAccount.isExternalAuthOnly()) { body.put("externalAuthOnly", Boolean.TRUE); } if (!errorCode.isEmpty()) { body.put(errorCode, Boolean.TRUE); } if (!confirmationCode.isEmpty()) { body.put(confirmationCode, Boolean.TRUE); } if (isProxyPanelAuthorized()) { body.put("showProxyPanel", Boolean.TRUE); } strategy.addMoreBodyValues(body); return new TemplateResponseValues(TEMPLATE_NAME, body); }
private ProxyInfo assembleProxyInfoForUser(UserAccount proxyUser) { String userUri = proxyUser.getUri(); String label = assembleUserAccountLabel(proxyUser); String classLabel = ""; String imageUrl = UrlBuilder.getUrl( PlaceholderUtil.getPlaceholderImagePathForType(vreq, VitroVocabulary.USERACCOUNT)); // Does this user have a profile? Can we get better info? Individual proxyProfilePage = getProfilePage(proxyUser); if (proxyProfilePage != null) { String thumbUrl = proxyProfilePage.getThumbUrl(); if ((thumbUrl != null) && (!thumbUrl.isEmpty())) { imageUrl = UrlBuilder.getUrl(thumbUrl); } classLabel = getMostSpecificTypeLabel(proxyProfilePage.getURI()); } return new ProxyInfo(userUri, label, classLabel, imageUrl); }
public String assembleWelcomeMessage() { if (!canSeeSiteAdminPage() && !isSelfEditorWithIndividual()) { // A special message for unrecognized self-editors: return i18n.text("logged_in_but_no_profile"); } String greeting = i18n.text("unknown_user_name"); int loginCount = 0; UserAccount userAccount = LoginStatusBean.getCurrentUser(request); if (userAccount != null) { loginCount = userAccount.getLoginCount(); if (StringUtils.isNotEmpty(userAccount.getFirstName())) { greeting = userAccount.getFirstName(); } else if (StringUtils.isNotEmpty(userAccount.getEmailAddress())) { greeting = userAccount.getEmailAddress(); } } return i18n.text("login_welcome_message", greeting, loginCount); }
boolean isExternalAuthOnly() { return (userAccount != null) && userAccount.isExternalAuthOnly(); }
private boolean emailIsChanged() { return !emailAddress.equals(userAccount.getEmailAddress()); }