[horde] Horde 4 and custom passwd driver

Jan Schneider jan at horde.org
Mon Mar 19 13:53:55 UTC 2012


Zitat von Ralf Lang <lang at b1-systems.de>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>>>> To me this seems to be a clumsy and I wondered how custom
>>>> drivers should be implemented correctly in Horde 4, without
>>>> having to touch passwd core code?
>>>>
>>>
>>> Are you talking about a custom passwd backend or a custom auth
>>> driver? How would you indicate to the factory that your 3rd party
>>> driver needs an sql instance?
>>
>> I guess this is exactly his question. And the answer is: you can't.
>> You have to pull in the dependencies manually, e.g. $db =
>> $GLOBALS['injector']->getInstance('Horde_Db_Adapter'), inside the
>> custom driver.
>>
>> Jan.
>>
> Yes I understand you cannot currently but I wonder IF the factory
> should be redesigned for H5 to support custom ldap and mysql scenarios
> or if this is overconfiguration.
>
> Like "if it has a db-params array, it must create a db" or something.

Theoretically the injector can already to this. It injects any objects  
that can be identified by type hints if it requested an object through  
a factory. The problem is that the driver that would take advantage of  
that, would need to use a different constructor signature than the  
base driver class, so this isn't really a universal solution either.
Doing some magical pulling-in if there is some certain key in a driver  
configuration's 'params' isn't a stable option either.
I don't think there isn't anything wrong with pulling in dependencies  
from *inside* the custom driver. This could still be optional, i.e.  
only if the dependency isn't passed explicitly, so you can still unit  
test that driver.

Jan.

-- 
The Horde Project
http://www.horde.org/




More information about the horde mailing list