On 6/6/13 3:19 PM, A.L.E.C wrote:
On 06/04/2013 05:47 PM, Philipp Kewisch wrote:
Alternatively, is there another way to intercept the identities and user management? We would like to use our own user management backend.
Maybe for your use-case would be better to replace the whole $RCMAIL->user object with some new class where you could overwrite methods used for identities management.
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.
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.
To fix this here is my new proposal. The functions are not tested, but give you an idea where I'm going:
Add a method to class rcube that allows replacing classes, i.e: function factory($rcubeClass, $args) { $cls = array( "className" => $rcubeClass); $cls = $this->plugins->exec_hook("factory", $cls); return call_user_func_array($cls["className"], $args); }
Add a method to class rcube that calls static methods of factory classes: function staticfactory($rcubeClass, $method, $args) { $cls = array( "className" => $rcubeClass); $cls = $this->plugins->exec_hook("factory", $cls); return call_user_func_array(array($cls["className"], $method),
$args); }
to use these functions
How does this sound for you? I'd like to bring roundcube to a state where we can do everything from a plugin.
Thanks, Philipp