[commits] [Wiki] created: ImapSelectH4

Jan Schneider jan at horde.org
Wed Sep 4 09:30:13 UTC 2013


jan  Wed, 04 Sep 2013 09:30:13 +0000

Created page: http://wiki.horde.org/ImapSelectH4

+ Dynamically selecting an IMAP server for authentication

**##red|This information is valid for Horde 4 only. See ImapSelectH3  
for Horde 3 or ImapSelect for Horde 5 and later.##**

++ An IMAP server selector hook function in Horde 4 {{imp/config/hooks.php}}
<code type="php">
class IMP_Hooks
{

public function preauthenticate($userId, $credentials)
{
     //Horde::logMessage('authM: '.$credentials['authMethod'].'  
id='.$userId, 'ERROR');
     //return true;

     /* when no userId given */
     if (empty($userId)) return true;

     /* list of ALL remote users */
     $remote_users = array('username at remoteserver.hu' =>  
'remote-imap-servers-key');

     /* local user */
     if (!array_key_exists($userId, $remote_users)) return true;

     /* remote user */
     return array('credentials' => array('server' => $remote_users[$userId],
                                         'transparent' => true,
                                         'password' =>  
$GLOBALS['registry']->getAuthCredential('password')
                                   )
     );
}

}
</code>

Set server list to 'hidden' in Imp prefs, and all backend's hordeauth to full.




More information about the commits mailing list