Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: Numbski on March 17, 2009, 12:20:06 PM

Title: Trying to figure out how/where to override identities.
Post by: Numbski on March 17, 2009, 12:20:06 PM
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?
Title: Trying to figure out how/where to override identities.
Post by: JohnDoh on March 18, 2009, 04:19:55 AM
Hi, The initial identity is created in the create funtion in program/include/rcube_user.php
Title: email and name in identites wrong
Post by: mattzyzy on December 04, 2009, 06:20:14 AM
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)
Title: Trying to figure out how/where to override identities.
Post by: mattzyzy on December 07, 2009, 05:34:26 AM
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])
Title: Trying to figure out how/where to override identities.
Post by: mattzyzy on December 31, 2009, 12:53:02 AM
any update guys?
or maybe I need to uncomment the ldap features in the codes to try it first...
Title: Trying to figure out how/where to override identities.
Post by: birger on July 25, 2010, 02:04:38 PM
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.
Title: Trying to figure out how/where to override identities.
Post by: SKaero on July 25, 2010, 02:36:05 PM
It sounds like you want the ldap_authentication plugin roundcubeldap - Project Hosting on Google Code (http://code.google.com/p/roundcubeldap/) I haven't used it but it sounds like what you want.
Title: Trying to figure out how/where to override identities.
Post by: birger on July 25, 2010, 04:44:15 PM
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.
Title: Trying to figure out how/where to override identities.
Post by: SKaero on July 25, 2010, 05:25:11 PM
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.