[imp] get pref Value in preauthenticate

Makeri makeri-kutsonu at t-online.de
Tue Oct 25 07:51:18 UTC 2011


Jan Schneider <jan <at> horde.org> writes:

> 
> 
> Zitat von Makeri <makeri-kutsonu <at> t-online.de>:
> 
> > Hello !
> >
> > We log in Horde per LDAP-User and want autologin to IMP (IMAP-Server).
> > Usernameand Password from Horde and IMP are not similar.
> >
> > In Horde3 i can save the IMAP-Login-Information in Horde and can
> > autologin to IMP.
> >
> > In Horde4 dont gives the option.
> >
> > So, i make 3 new prefs in horde-hooks, where the User save his  
> > Login-Information
> > (servername, loginname and password).
> 
> Where? How?

Sorry - not in horde-hooks.

I defined in horde/config/prefs.local.php 3 new fields and 1 new checkbox :

// EIGENE - Mail-Zugangsdaten

$prefGroups['owngroup01'] = array(
    'column' => 'Eigene-Erweiterungen',
    'label' => 'Mailserver Zugangsdaten',
    'desc' => 'Mailserverdaten kannst Du hier hinterlegen',
    'members' => array(
        'own_mail_server', 'own_mail_login', 'own_mail_pw_gleich',
'own_mail_passwort'
    )
);

// pw in horde and imap are similar - so user dont need save his password. I can
get it with getAuthCredential('password')

$_prefs['own_mail_pw_gleich'] = array(
    'value' => false,
    'type' => 'checkbox',
    'desc' => 'IMAP-MailPasswort ist das gleiche wie bei Webmail'
);

// Mailserver
$_prefs['own_mail_server'] = array(
    'value' => 'mail.domain.de',
    'type' => 'text',
    'desc' => 'Bitte Mailserver angeben'
);

// Loginname
$_prefs['own_mail_login'] = array(
    'value' => '',
    'type' => 'text',
    'desc' => 'Mail-Loginname :'
);

// Passwort
$_prefs['own_mail_passwort'] = array(
    'value' => '',
    'type' => 'text',
    'desc' => 'Mail-Passwort :'
);

And now i want get this values is preauthenticate of imp :

     public function preauthenticate ($userId, $credentials)
     {
global $GLOBALS, $prefs;
global $conf, $injector, $language, $prefs, $registry, $_prefs;
        $tmp_horde_user = $GLOBALS['registry']->getAuth();

        if (!empty($tmp_horde_user))
         {

        If ($prefs['own_mail_server'])
         {
        $own_mail_pw_gleich = @$GLOBALS['prefs']->getValue('own_mail_pw_gleich');
        $own_mail_server = @$GLOBALS['prefs']->getValue('own_mail_server');
        $own_mail_login = @$GLOBALS['prefs']->getValue('own_mail_login');
        $own_mail_passwort = @$GLOBALS['prefs']->getValue('own_mail_passwort');

        if (!empty($own_mail_server) && !empty($own_mail_login) &&
!empty($own_mail_passwort))
         {
          $result['userId'] = $own_mail_login;
          if ($own_mail_pw_gleich)
           {
            $credentials['password'] =
$GLOBALS['registry']->getAuthCredential('password');
           }
          else
           {
            $credentials['password'] = $own_mail_passwort;
           }
          $credentials['transparent'] = "true";
          return $result;
         } // end if empty ...

         } // end if prefs own_mail_server

        } // end if not empty horde_user

     }


But it does not work !

> 
> > Now, i want acces to this settings, in the function "preauthenticate" in IMP.
> >
> > But i cant !
> >
> > How can i acces it ?
> >
> >
> > $GLOBALS[prefs]->getValue('mail_server_name')
> > $GLOBALS[prefs]['mail_server_name']
> >
> > prefs->getValue('mail_server_name')
> > prefs['mail_server_name']
> >
> > and with _prefs ...
> >
> > dont work.
> >
> >
> > Please help !
> >
> >
> >
> > --
> > IMP mailing list
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: imp-unsubscribe <at> lists.horde.org
> 
> Jan.
> 






More information about the imp mailing list