Exemplo n.º 1
0
  public void addUser(
      long companyId,
      long userId,
      String password,
      String firstName,
      String middleName,
      String lastName,
      String emailAddress) {

    try {
      String nickname = _getNickname(emailAddress);

      GUserManager gUserManager = GoogleAppsFactoryUtil.getGUserManager(companyId);

      gUserManager.addGUser(userId, password, firstName, lastName);

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.addGNickname(userId, nickname);

      GEmailSettingsManager gEmailSettingsManager =
          GoogleAppsFactoryUtil.getGEmailSettingsManager(companyId);

      FullNameGenerator fullNameGenerator = FullNameGeneratorFactory.getInstance();

      gEmailSettingsManager.addSendAs(
          userId, fullNameGenerator.getFullName(firstName, middleName, lastName), emailAddress);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Exemplo n.º 2
0
  public void deleteUser(long companyId, long userId) {
    try {
      GUserManager gUserManager = GoogleAppsFactoryUtil.getGUserManager(companyId);

      gUserManager.deleteGUser(userId);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Exemplo n.º 3
0
  public void updatePassword(long companyId, long userId, String password) {
    try {
      GUserManager gUserManager = GoogleAppsFactoryUtil.getGUserManager(companyId);

      gUserManager.updatePassword(userId, password);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Exemplo n.º 4
0
  public void updateEmailAddress(long companyId, long userId, String emailAddress) {

    try {
      User user = UserLocalServiceUtil.getUserById(userId);

      deleteEmailAddress(companyId, userId);

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.addGNickname(userId, emailAddress);

      GEmailSettingsManager gEmailSettingsManager =
          GoogleAppsFactoryUtil.getGEmailSettingsManager(companyId);

      gEmailSettingsManager.addSendAs(userId, user.getFullName(), emailAddress);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Exemplo n.º 5
0
  public void deleteEmailAddress(long companyId, long userId) {
    try {
      User user = UserLocalServiceUtil.getUserById(userId);

      String nickname = _getNickname(user.getEmailAddress());

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.deleteGNickname(nickname);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }