[whups] automatic assigning of tickets, e-mail address guessing - is it possible ?
David Komanek
xdavid at lib-eth.natur.cuni.cz
Wed May 4 05:08:29 PDT 2005
>>> And one more question: how is determioned whether the whups user has an
>>> e-mail address ? I noticed "From:" in horde default identity is evaluated.
>>> But if the user had to authenticate itself to horde via IMAP (for
>>> example), we already know his address. Would it be possible to have some
>>
>> No, we only know his username, not his email address.
>
> But if we know the username and the servername where the post is stored,
> it would in most cases end up in the correct address if we place '@'
> between. But sure, I have no idea how much work it would be to couple this
> feature with administration GUI.
>
>
>>
>>> hierarchy where to look for the addresses before giving up and not sending
>>> an email motice ?
>>
>> Create a hook for the from_addr preference.
>
Well, I created the hook :-) If someone is interested, the code is
bellow.
I didn't use preference hook for "from_addr" because what I really need is
not the default address for new identities, but the value for the default
identity, even when the identity already exists. From prefes hook I was
unable to write to other preferences (do not know why), so I created a
postauthentication hook which does everything needed. The only thing I
have not resolved is how to tell the preferences cache to update the data
immediatelly. But in the database everything is stored so this resolves at
the next login automatically.
require_once('Horde/Identity.php');
if (!function_exists('_horde_hook_postauthenticate')) {
function _horde_hook_postauthenticate($userID, $credential, $realm)
{
$name = "$userID";
if (is_null($name)) {
$name = Auth::getAuth();
}
if (!empty($name)) {
$users_identities = &Identity::singleton('none',"$name");
$users_identities->init();
$users_identity_default_from_addr = $users_identities->getValue('from_addr');
if (empty($users_identity_default_from_addr)) {
$mail = "$name" . "@natur.cuni.cz";
$users_identities->setValue('from_addr',"$mail");
$users_identities->save();
} else {
$mail = "$users_identity_default_from_addr";
}
// If no email address is found, then the login name will
// be used.
return (empty($mail) ? '' : $mail);
}
return '';
}
}
BR,
David
More information about the whups
mailing list