[RCD] The identities_list hook

Philipp Kewisch pkewisch at linagora.com
Sat Jun 8 09:55:29 CEST 2013


On 6/7/13 2:26 PM, A.L.E.C wrote:
> On 06/07/2013 02:01 PM, Philipp Kewisch wrote:
>> Indeed, replacing the whole rcube_user class with my own implementation
>> is ideal, I haven't gone this route because there is some code that
>> assumes rcube_user is the only class to handle users and this sounds
>> more invasive to me.
> Just make your class to inherit from rcube_user, no?
Sorry I was unclear, this is what I am doing, yes.
>
>> I initially tried to just call set_user() from the init function of the
>> plugin, but this is already too late. Also I found out there are a few
>> static functions that are called on rcube_user which need to be called
>> on my class.
> It's query() and create(). Query() shoudn't be a problem. In create(),
> after user record creation, identities are created, but you can use
> identity_create hook with abort=true to handle identity creation and
> skip default action.
>
> A good place to replace user object is the 'ready' hook.

Actually, query seems to be a problem. Here the user is initially set:
https://github.com/roundcube/roundcubemail/blob/master/program/include/rcmail.php#L495

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.

 From the looks of it I was able to work around all other issues.

What do you think?

Philipp



More information about the dev mailing list