/**
   * Get the user infos from a given id record and id entry. <br>
   * The retrieval of the user infos depends on the entry type : <br>
   *
   * <ul>
   *   <li>If it is an {@link EntryTypeMyLuteceUser}, then it will use the {@link SecurityService}
   *       API
   *   <li>If it is an {@link EntryTypeRemoteMyLuteceUser}, then it will use the {@link
   *       UserAttributesService} API
   * </ul>
   *
   * @param strUserGuid the user guid
   * @param nIdEntry the id entry
   * @return a {@link ReferenceList}
   */
  public ReferenceList getUserInfos(String strUserGuid, int nIdEntry) {
    ReferenceList userInfos = null;

    if (StringUtils.isNotBlank(strUserGuid)) {
      Plugin plugin = PluginService.getPlugin(DirectoryPlugin.PLUGIN_NAME);
      IEntry entry = EntryHome.findByPrimaryKey(nIdEntry, plugin);

      if ((entry != null) && (entry.getEntryType() != null)) {
        if ((entry.getEntryType().getIdType()
                == AppPropertiesService.getPropertyInt(
                    PROPERTY_ENTRY_TYPE_REMOTE_MYLUTECE_USER, 21))
            && DirectoryUserAttributesManager.getManager().isEnabled()) {
          userInfos =
              DirectoryUtils.convertMapToReferenceList(
                  DirectoryUserAttributesManager.getManager().getAttributes(strUserGuid));
        } else if (entry.getEntryType().getIdType()
            == AppPropertiesService.getPropertyInt(PROPERTY_ENTRY_TYPE_MYLUTECE_USER, 19)) {
          LuteceUser user = SecurityService.getInstance().getUser(strUserGuid);

          if (user != null) {
            userInfos = DirectoryUtils.convertMapToReferenceList(user.getUserInfos());
          }
        }
      }
    }

    return userInfos;
  }
コード例 #2
0
 /**
  * Check whether a user must change his password
  *
  * @param databaseUser The user to check
  * @param plugin The plugin
  * @return True if a user must change his password, false otherwise.
  */
 public boolean mustUserChangePassword(LuteceUser databaseUser, Plugin plugin) {
   return DatabaseHome.findResetPasswordFromLogin(databaseUser.getName(), plugin);
 }