Ok I committed my version of the fix to CVS. I hope it will work for you too...


Here is the change in JahiaUserManagerLDAPProvider:

 @@ -995,28 +995,28 @@
          if (usingUserKey != null) {
              mapLDAPToJahiaProperties(userProps);
              // FIXME : Quick hack for merging Jahia DB user properties with LDAP user
 -            mapDBToJahiaProperties (userProps, usingUserKey);
 +            mapDBToJahiaProperties (userProps, JahiaLDAPUser.USERKEY_LDAP_PREFIX + 
usingUserKey);


As you can see it is also quite minimal.

Regards,
 Serge Huber

Serge Huber wrote:


Actually I looked at it in more detail, and I'm not going to solve this this way, because it changes the notion of userKey throughout the system, and will not be backwards compatible.


I am going to correct the properties loading so that it properly appends the prefix.

The problem is that the prefix IS used indirectly because it then influences the behavior of the JahiaUser.getUserKey method which is used throughout Jahia, and I think it is quite risky to change this now. I prefer to live with duplicate prefixes in the jahia_user_prop table.

Regards,
 Serge Huber.

Predrag Viceic wrote:

Hi Serge,

My patch is definitely *NOT* the best way to solve this. However it introduces the smallest possible amount of enthropy in the code... :)

Seriously, when you added the field provider_jahia_user_prop in the table jahia_user_prop, the need to prepending the '{ldap}' prefix has disapeared. so this prefix isn't needed any more, and can be removed from:

JahiaGroupManagerLDAPProvider::lookupGroup (int siteID, String name){
    //String tmpGroupName = removeKeyPrefix(name);
    String tmpGroupName=name; //for the sake of consistency


JahiaUserManagerLDAPProvider::lookupUser (int siteID, String name){ //String tmpUserName = removeKeyPrefix(name); String tmpUserName=name; //for the sake of consistency



and as I mentioned below:

public class JahiaLDAPUser implements JahiaUser
{
   //static final public String USERKEY_LDAP_PREFIX = "{ldap}";//this

and

public class JahiaLDAPGroup implements JahiaUser
{

    //static final public String GROUPKEY_LDAP_PREFIX = "{ldap}";


This string is not used elsewhere (me thinks..). Neither lookupUser nor lookupGroupInLDAP, two methods that contruct JahiaUser and JahiaGroup objects use the %_LDAP_PREFIX.



Hope it helps, Predrag


Le lundi 25 Octobre 2004 15:57, Serge Huber a �crit :


Ok I can confirm we still have this bug. I will look at this more
closely to see if your patch is the best way to solve this.

Regards,
 Serge Huber.

Serge Huber wrote:


Hmm... Has someone already tested this with the current 4.0.5 CVS ?
Because it's always takes some times to setup LDAP environment to test
these problems.

Regards,
Serge Huber.

Predrag Viceic wrote:


Hi,

There is a bug in my version (4.0 beta3) of Jahia in the class
JahiaLDAPUser. Maybe you have already corrected it in the newer
releases, I'll submit the patch however:

public class JahiaLDAPUser implements JahiaUser
{
//static final public String USERKEY_LDAP_PREFIX = "{ldap}";//this
is bad
static final public String USERKEY_LDAP_PREFIX = ""; //this is good


In fact this bug doesn't allow the retrieval of db properties of the
LDAP user after reboot.
lookupUser() removes the prefix, but the JahiaLDAPUser constructor
ads it, so the setProperty() prepends {ldap} to the property name,
but getProperty(), done in the construction of JahiaLDAPUSer object
(mapDPToJahia()) doesn't use it . As properties are fetched from the
db only on initial construction of the user object, they are not
fetched..

I have tested the patch, and it works.

Regards
Predrag









Reply via email to