Roundcube Community Forum

 

Trying to figure out how/where to override identities.

Started by Numbski, March 17, 2009, 12:20:06 PM

Previous topic - Next topic

Numbski

I see there's an old plugin regarding LDAP and identities that doesn't work for 2.0, which is fine, because I'm already having to hack around a bit because our SpamAssassin table uses e-mail addresses instead of usernames, and I *just* figured that little bit out.  Basically I've added a bunch of


        global $USER;
        $identity = $USER->get_identity($attrib['user_id']);


to sauserprefs.inc and save_sauserprefs.inc, and everywhere there's a sql call for


WHERE  ". $sauserprefs_config['sql_username_field'] ." = '". $_SESSION['username'] ."'


I've changed it to:


WHERE  ". $sauserprefs_config['sql_username_field'] ." = '". $identity['email'] ."'


That gives my spamassassin prefs the right values presuming I have the correct email address for my identity.

The next step is to automatically populate identities with the fields displayName and mail from LDAP, versus the default behavior of username@domain, which in our case in incorrect.  The trick is that I can't figure out where the initial entry to the sql database for identities is being generated in the code.   I'd like to prevent it from being done if the fields displayName and mail are populated, and if they are, override the default behavior.  Seems simple enough, but I can't figure out *where* to make that change. :(

Help?

JohnDoh

Hi, The initial identity is created in the create funtion in program/include/rcube_user.php
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

mattzyzy

QuoteThe next step is to automatically populate identities with the fields displayName and mail from LDAP, versus the default behavior of username@domain, which in our case in incorrect. The trick is that I can't figure out where the initial entry to the sql database for identities is being generated in the code. I'd like to prevent it from being done if the fields displayName and mail are populated, and if they are, override the default behavior. Seems simple enough, but I can't figure out *where* to make that change.

Help?

Is this specific problem have a patch until now ? or codes would be welcome too

mine too got the same problem(email and name in identities wrong/empty) where the the LDAP mail attribute not being pick (during auto register for first-time login enabled - into MySQL 5.0.88) as the email field in the identities table instead took it from the username@hostname (the username prior the the @hostname is only uid attribute in the LDAP , not related at all to the mail attribute , and mostly different . )

My config :
RoundCube Webmail/0.3.1
Apache/2.0.63 (Win32) PHP/5.2.11 Server at localhost Port 80
LDAP (Sun Directory)

mattzyzy

Thanks for your kind attention.
these are LDAP/LDIF attributes with sample values .

uid : theusername  ([RC] username field in users table = [email protected])
cn: User Full Name ([RC] name field in identities table = User Full Name)
mail: [email protected]  ([RC] email field in identities table = [email protected])

mattzyzy

#4
any update guys?
or maybe I need to uncomment the ldap features in the codes to try it first...

birger

is there any update on this issue? it would be great to have a hook to set the identity of the user. it is possible to use the new_user_identity plugin, but i don't want the data to be saved in sql. the identity should be set from ldap every time a user logs in.

SKaero

It sounds like you want the ldap_authentication plugin roundcubeldap - Project Hosting on Google Code I haven't used it but it sounds like what you want.

birger

i don't think the ldap_authentication can help. it didn't work for me, the code looks like heavy work in progress and the create_identity hook isn't even written yet. and even if it was, it would also save the identity in sql the first time the user logs in and don't fetch it again if the user logs in agian.
the problem is, if the name or the email adress changes in ldap, it won't affect the identity in roundcube.

SKaero

I see what your saying, I think it could be done but it would require some core code modification. It maybe able to be done with a plugin but it would require some extra coding for checks & updates. I don't think there is anything in RoundCube like this now.