[horde] Dynamic, Minimalist, Traditional selection?
Jan Schneider
jan at horde.org
Fri Oct 10 15:17:03 UTC 2008
Zitat von horde at corwyn.net:
> At 05:18 AM 10/10/2008, Jan Schneider wrote:
>>> I see the login driver needs to be the application driver to trigger
>>> the choices for Dyn, Min, and Trad, yes?. How does everything else
>>> know what to pick?
>
> Still a question
>
>> No, Horde can stretch even more. :) You can achieve that by creating a
>> _horde_hook_signup_addextra hook. If you've gone through that, it
>> would great if you could add instructions to the howto.
>
> A better point here is whether _I_ can stretch more. *sigh*.
> Catch-22 I think, but we'll give 'er a go.
>
> Ok, so in config/conf.php I add as part of my composite query next
> to 'query_add':
> 'query_add2' => 'INSERT INTO alias
> (address,goto,domain,created,modified) VALUES (\L, \L, RIGHT(\L,
> (LENGTH(\L)-(INSTR(\L, \'@\')))), now(), now());';
>
> in config/hooks.php I add:
> if (!function_exists('_horde_hook_signup_addextra')) {
> function _horde_hook_signup_addextra($userID)
> {
> global $conf;
>
> require_once 'DB.php';
> $_db = &DB::connect($conf['mysqli'], true);
> $query = $this->_params['query_add2'];
> $query = str_replace('\L',$this->_db->quote($userID, $query);
> $result = $_db->query($query);
>
> return is_a($result, 'PEAR_Error') ? $result : true;
> }
> }
>
> (which I at least thing will work based on the code from
> horde/lib/Horde/Auth/customsql.php)
>
> However, config/hooks.php says: "Having a hook function in this file
> does NOT mean that the hook will automatically be used. YOU MUST
> enable the hook."
>
> From the documentation in hooks.php, that looks like I need
> horde_hook_somethig or other,
> or do I set
> $conf[hooks][auth2] = true
>
> or something in between?
Looking at the code it seems that you also have to specify the
_horde_hook_signup_getextra, so that the signup_addextra is actually
triggered.
> I feel like it's close, but not working!
>
> Rick
>
>
>>> //composite of mysql and application driver
>>> $conf['auth']['driver'] = 'composite';
>>> //composite mysql driver
>>> $conf['auth']['params']['drivers']['customsql_mod']['driver'] =
>>> 'customsql';
>>> $conf['auth']['params']['drivers']['customsql_mod']['params'] = array(
>>> 'phptype' => 'mysqli',
>>> 'protocol' => 'unix',
>>> 'hostspec' => 'localhost',
>>> 'username' => 'postfix',
>>> 'password' => 'pfix1723',
>>> 'database' => 'postfix',
>>> 'query_auth' => 'SELECT * FROM mailbox WHERE username = \L and
>>> password=\P; ',
>>> 'query_add' => 'INSERT INTO mailbox
>>> (username,password,maildir,quota,domain,created,modified) VALUES
>>> (\L, \P, CONCAT(RIGHT(\L, (LENGTH(\L)-(INSTR(\L, \'@\')))), \'/\',
>>> LEFT(\L, INSTR(\L,\'@\')-1) , \'/\') ,\'512000000\', RIGHT(\L,
>>> (LENGTH(\L)-(INSTR(\L, \'@\')))), now(), now());',
>>> 'query_getpw' => 'SELECT password FROM mailbox WHERE username = \L;',
>>> 'query_update' => 'UPDATE mailbox SET username = \L WHERE username =
>>> \O) LIMIT 1;',
>>> 'query_resetpassword' => 'UPDATE mailbox SET password = \P WHERE
>>> username = \L;',
>>> 'query_remove' => 'DELETE FROM mailbox WHERE username = \L;',
>>> 'query_list' => 'SELECT * FROM mailbox;',
>>> 'query_exists' => 'SELECT 1 FROM mailbox WHERE username = \L;',
>>> 'encryption' => 'crypt-md5',
>>> 'show_encryption' => false);
>>> //composite application driver
>>> $conf['auth']['params']['drivers']['application_mod']['driver'] =
>>> 'application';
>>> $conf['auth']['params']['drivers']['application_mod']['params'] = array(
>>> 'app' => 'imp');
>>> //selecting the login driver
>>> $conf['auth']['params']['admin_driver'] = 'customsql_mod';
>>> $conf['auth']['params']['loginscreen_switch'] =
>>> '_horde_select_loginscreen';
>>> if (!function_exists('_horde_select_loginscreen')) {
>>> function _horde_select_loginscreen()
>>> {
>>> return 'application_mod';
>>> }
>>> }
>>>
>>>
>>> At 07:50 PM 10/9/2008, Jan Schneider wrote:
>>>> 2b. Use composite authentication.
>>
>> Jan.
>
>
>
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the horde
mailing list