/**
   * 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
 /**
  * Login automatically the database user
  *
  * @param request the HTTP request
  * @param DatabaseUser databaseUser
  * @param plugin the plugin
  */
 public void doAutoLoginDatabaseUser(
     HttpServletRequest request, DatabaseUser databaseUser, Plugin plugin) {
   if (_baseAuthentication != null) {
     BaseUser user =
         DatabaseHome.findLuteceUserByLogin(databaseUser.getLogin(), plugin, _baseAuthentication);
     SecurityService.getInstance().registerUser(request, user);
   }
 }