Sven Hartge wrote:
Sven Hartge sven@svenhartge.de wrote:
I am in the process of deploying Roundcube (0.9.5) and so far everything works fine, including the import of the addressbook of our legacy Squirremail webmailer and the initial creation of the user via the new_user_identity plugin using our LDAP server.
Now I only need a way to overwrite/set/force the identity of the user from the LDAP server on every login of a user.
For Roundcube I have looked at the provided plugin hooks, but I am currently a bit lost on how to proceed. The user_create hook is obviously only invoked on the first login, so cannot be used for later changes.
The user2mail hook looks promising but I was unable to find (and understand) an example on how to use it (I am a Perl guy, PHP is like a 4th language for me ;)).
OK. After implementing a very simple test-plugin, which just hooks user2email and sets $args['email'] to a fixed value, I discoverd that user2email is only called during create() from rcube_user.php. Reading the changelog this was made during the outsourcing of the virtuser_* functions into their own separate plugins.
All the hooks you listed so far are only called once then the user logs in for the first time.
I have not found any other hook in 0.9.5 where I might overwrite the identity of already existing users.
I suggest to use the 'login_after' hook to verify/update a user's identities on login. That hook is also available in 0.9.5 so don't worry about that.
So in 'login_after' for example, you have access to the user object with its identities like this:
$user = rcmail::get_instance()->user; foreach ($user->list_identities() as $identity) { // check and update here }
~Thomas