public boolean isPhotoOwner(Photo photo) { boolean result = false; Client client = getClient(); if ((photo != null) && (client instanceof User)) { User user = (User) client; result = photo.getOwnerName().equals(user.getName()); } return result; }
/** Returns some signifier of current user */ public String getClientName() { String result = "anon"; if (!StringUtil.isNullOrEmptyString(getEmailAddressAsString())) { result = getEmailAddressAsString(); if (client instanceof User) { User user = (User) client; result = user.getName(); } } return result; }
public void emailWelcomeMessage(UserSession us, User user) { ModelConfig config = us.getClient().getLanguageConfiguration(); EmailAddress from = config.getAdministratorEmailAddress(); EmailAddress to = user.getEmailAddress(); String emailSubject = config.getWelcomeEmailSubject(); String emailBody = config.getWelcomeEmailBody() + "\n\n"; emailBody += config.getWelcomeEmailUserName() + user.getNickName() + "\n\n"; emailBody += config.getGeneralEmailRegards() + "\n\n----\n"; emailBody += config.getGeneralEmailFooter() + "\n\n"; EmailService emailService = EmailServiceManager.getDefaultService(); emailService.sendEmailIgnoreException( from, to, config.getAuditEmailAddress(), emailSubject, emailBody); }
public User getUserByEmailAddress(EmailAddress emailAddress) { User result; result = readObject(User.class, User.EMAIL_ADDRESS, emailAddress.asString()); if (result != null) { User current = getUserById(result.getId()); if (current == null) { doAddClient(result); } else { result = current; } } return result; }