Пример #1
0
 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;
 }
Пример #2
0
 /** 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;
 }
Пример #3
0
  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);
  }
Пример #4
0
  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;
  }