On 6/10/13 9:48 PM, Philipp Kewisch wrote:
On 6/8/13 10:11 AM, A.L.E.C wrote:
On 06/08/2013 09:55 AM, Philipp Kewisch wrote:
Actually, query seems to be a problem. Here the user is initially set: https://github.com/roundcube/roundcubemail/blob/master/program/include/rcmai...
If the user doesn't exist in the roundcube database, $user will be empty. I've disabled auto_user_create since I don't want double entries in the database, so I end up with the error message that the user will not be created.
I don't see a problem here. $user will be empty but after successful login rcube_user::create() is used. Do you want to override identities or maybe users database too? You initially talked about identities and I don't see a problem for identities.
Sorry, I'm being very confusing and I feel bad for it. Let me start at the beginning.
Initially I was looking for a way to use the identities from our system within roundcube. We also have an addressbook and authentication plugin that use the provided hooks. Roundcube users were being created in the database, auto_create_user is on. My initial thought was the same as you later on suggested, replace rcube_user. I then noticed the seemingly easy way of using identities_list, but afterwards found out its only for the columns and display.
I wrote my first email, where you replied that extending rcube_user would make sense. I went back to my original thought of replacing rcube_user and had success, the identities are now shown from our system. As I now have my own rcube_user class to work with, it makes sense to consolidate the authentication plugin and avoid essentially duplicating the users table from our system. For this to work I would need to replace the rcube_user::query method.
I think it would be a win for roundcube to allow plugins to easily replace the rcube_user class, so if you agree I'd like to discuss how to best go about it.
I hope this explains a bit better, I promise to be more concise in future emails :)
Philipp
Any updates? I've done some more testing and found out that with the current way I am attempting to replace the user object (i.e doing so in the init() method) doesn't fully work. Login works without problems, but navigating to the settings and clicking on an identity doesn't show the identities form but instead the login window. Using the "ready" hook doesn't help either.
Instead of my earlier proposal, maybe it would be more roundcube-like to add a plugin hook that takes care of creating the user objects. Maybe something like this?
user_set -- called before set_user is called params: $session_id return: rcube_user instance user_create -- called before rcube_user::create params: $user, $host return: rcube_user instance user_query -- called before rcube_user::query params: $user, $host return: rcube_user instance
Philipp