Move more configuration to Horde.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Oct 2009 11:01:14 +0000 (05:01 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Oct 2009 18:01:47 +0000 (12:01 -0600)
Remove 'realm' from server configuration (this should be done via the
authentication hooks).
Remove 'uniquser' (Horde_Auth::getAuth() returns the unique Horde
user ID).

imp/acl.php
imp/compose.php
imp/config/servers.php.dist
imp/docs/UPGRADING
imp/lib/Application.php
imp/lib/Auth.php
imp/lib/Compose.php
imp/lib/Spam.php
imp/lib/UI/Compose.php

index 2cae5d0..d7d5b24 100644 (file)
@@ -124,7 +124,7 @@ if (empty($folder)) {
 }
 
 $curr_acl = $ACLDriver->getACL($folder);
-$canEdit = $ACLDriver->canEdit($folder, $_SESSION['imp']['uniquser']);
+$canEdit = $ACLDriver->canEdit($folder, Horde_Auth::getAuth());
 
 require_once 'Horde/Prefs/UI.php';
 
index cffaeee..66824d5 100644 (file)
@@ -880,7 +880,7 @@ if ($redirect) {
 
     $hidden = array(
         'actionID' => '',
-        'user' => $_SESSION['imp']['uniquser'],
+        'user' => Horde_Auth::getAuth(),
         'compose_requestToken' => Horde::getRequestToken('imp.compose'),
         'compose_formToken' => Horde_Token::generateId('compose'),
         'composeCache' => $composeCacheID,
index 763b2bc..d16900d 100644 (file)
  *       have an effect. By default, IMAP messages are output in the IMAP
  *       server default language. (IMAP only)
  *
- * realm: (string) ONLY USE REALM IF YOU ARE USING IMP FOR HORDE
- *        AUTHENTICATION, YOU HAVE MULTIPLE SERVERS, AND USERNAMES OVERLAP
- *        BETWEEN THOSE SERVERS.
- *
- *        If you only have one server, or have multiple servers with no
- *        username clashes, or have full user@example.com usernames, you DO
- *        NOT need a realm setting. If realm is set, a '@' symbol plus the
- *        realm value will be appended to the username that users login to
- *        IMP with to create the username that Horde treats the user as.
- *
- *        Example: with a realm of 'example.com', the username 'jane' would
- *        be treated by Horde (NOT your IMAP/POP server) as 'jane@example.com',
- *        and the username 'jane@example.com' would be treated as
- *        'jane@example.com@example.com' - an occasion where you probably
- *        don't need a realm setting.
- *
  * preferred: (string) Only useful if you want to use the same servers.php file
  *            for different machines: if the hostname of the IMP machine is
  *            identical to one of those in the preferred list, then the
index 7f7b960..f87673c 100644 (file)
@@ -22,6 +22,14 @@ IMP only supports the FCKeditor javscript HTML GUI editor.  Xinha is no longer
 supported.
 
 
+Server Options
+--------------
+
+The 'realm' option has been removed.  Altering usernames at runtime should
+instead by accomplished by using Horde's authusername() and/or IMP's
+preauthenticate() hooks.
+
+
 Configuration Options
 ---------------------
 
index ca390f0..a9d1e2d 100644 (file)
@@ -302,10 +302,6 @@ class IMP_Application extends Horde_Registry_Application
             $_SESSION['imp']['cache']['select_view'] = empty($credentials['imp_select_view'])
                 ? ''
                 : $credentials['imp_select_view'];
-
-            /* Set the Horde ID, since it may have been altered by the 'realm'
-             * setting. */
-            $credentials['auth_ob']->setCredential('userId', $_SESSION['imp']['uniquser']);
         }
     }
 
index 8046f62..bef0036 100644 (file)
@@ -131,11 +131,12 @@ class IMP_Auth
             break;
         }
 
+        $auth_id = Horde_Auth::getAuth();
         $imap_ob = $GLOBALS['imp_imap']->ob();
 
         $msg = sprintf(
-            $status_msg . ' for %s [%s]%s to {%s:%s [%s]}',
-            empty($_SESSION['imp']['uniquser']) ? '' : $_SESSION['imp']['uniquser'],
+            $status_msg . '%s [%s]%s to {%s:%s [%s]}',
+            $auth_id ? '' : ' for ' . $auth_id,
             $_SERVER['REMOTE_ADDR'],
             empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? '' : ' (forwarded for [' . $_SERVER['HTTP_X_FORWARDED_FOR'] . '])',
             $imap_ob ? $imap_ob->getParam('hostspec') : '',
@@ -168,7 +169,6 @@ class IMP_Auth
      * 'smtp'          -- SMTP options ('host' and 'port')
      * 'showunsub'     -- Show unsusubscribed mailboxes on the folders screen.
      * 'tasklistavail' -- Is listing of tasklists available?
-     * 'uniquser'      -- The unique user name.
      * 'view'          -- The imp view mode (currently dimp, imp, or mimp)
      *
      * @param array $credentials  An array of login credentials.
@@ -198,16 +198,6 @@ class IMP_Auth
             throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
         }
 
-        /* Determine the unique user name. */
-        if (Horde_Auth::getAuth()) {
-            $_SESSION['imp']['uniquser'] = Horde_Auth::getOriginalAuth();
-        } else {
-            $_SESSION['imp']['uniquser'] = $credentials['userId'];
-            if (!empty($ptr['realm'])) {
-                $_SESSION['imp']['uniquser'] .= '@' . $ptr['realm'];
-            }
-        }
-
         /* Try authentication. */
         try {
             self::authenticate(array(
index 9b442c3..0013641 100644 (file)
@@ -554,7 +554,7 @@ class IMP_Compose
             }
         }
 
-        $entry = sprintf("%s Message sent to %s from %s", $_SERVER['REMOTE_ADDR'], $recipients, $_SESSION['imp']['uniquser']);
+        $entry = sprintf("%s Message sent to %s from %s", $_SERVER['REMOTE_ADDR'], $recipients, Horde_Auth::getAuth());
         Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
 
         /* Should we save this message in the sent mail folder? */
@@ -2423,7 +2423,7 @@ class IMP_Compose
             return;
         }
 
-        $filename = hash('md5', $_SESSION['imp']['uniquser']);
+        $filename = hash('md5', Horde_Auth::getAuth());
         $vfs = VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
         if ($vfs->exists(self::VFS_DRAFTS_PATH, $filename)) {
             $data = $vfs->read(self::VFS_DRAFTS_PATH, $filename);
index b958930..0472712 100644 (file)
@@ -136,7 +136,7 @@ class IMP_Spam
                     if (!is_null($from_line)) {
                         $spam_headers->addHeader('From', $from_line);
                     }
-                    $spam_headers->addHeader('Subject', sprintf(_("%s report from %s"), $action, $_SESSION['imp']['uniquser']));
+                    $spam_headers->addHeader('Subject', sprintf(_("%s report from %s"), $action, Horde_Auth::getAuth()));
 
                     /* Send the message. */
                     try {
index 2c21d01..49bbb19 100644 (file)
@@ -69,7 +69,7 @@ class IMP_UI_Compose
         }
 
         $entry = sprintf("%s Redirected message sent to %s from %s",
-                         $_SERVER['REMOTE_ADDR'], $recipients, $_SESSION['imp']['uniquser']);
+                         $_SERVER['REMOTE_ADDR'], $recipients, Horde_Auth::getAuth());
         Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
 
         if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {