[horde] hook to select default identity
LALOT Dominique
dom.lalot at gmail.com
Mon Oct 17 19:59:41 UTC 2011
Hello,
I would like to push tow identities for a user thanks to a hook. The user
then would be able to select one of the identities.
How can I dot that?
I'm already using the hook from_addr
The initial purpose is to switch from a domain to another one and let the
user choose what identity to use.
I played with identities and hook. I was able to add identities, but then
the user is able to change the values and delete the identities. How can I
protect? I put these values in prefs.local.php
$_prefs['default_identity']['locked']=false;
$_prefs['default_identity']['value']=0;
$_prefs['identities']['locked']=true;
$_prefs['identities']['hook']=true;
$_prefs['from_addr']['locked']=false;
$_prefs['from_addr']['hook']=false;
and in the hook (sorry, I'm rather a PERL programmer)
case 'identities':
$ds = $this->_ldap_connect();
$justecela=array('displayname','mail','amumail','maillocaladdress');
$searchResult = @ldap_read($ds,
'uid='.$username.','.$searchBase,'uid=*',$justecela);
$information = @ldap_get_entries($ds, $searchResult);
$user = $information[0]['displayname'][0];
$amumail = $information[0]['amumail'][0];
$mail = $information[0]['mail'][0];
ldap_close($ds);
$default=array('from_addr'=>$amumail,'fullname'=>$user,'id'
=>'univ-amu');
$old=array('from_addr'=>$mail,'fullname'=>$user,'id'
=>'univmed');
$Talias=array();
foreach ($information[0]['maillocaladdress'] as $alias){
if ($alias==$mail or $alias==$amumail) continue;
$Talias=array_merge($Talias,array('from_addr'=>$alias,'fullname'=>$user,'id'
=>$alias));
}
$ident=array($default,$old,$Talias);
return(serialize($ident));
Thanks in advance
Dom
--
Dominique LALOT
Ingénieur Systèmes et Réseaux
http://annuaire.univmed.fr/showuser.php?uid=lalot
More information about the horde
mailing list