removes user email handling for non-email ldap plugins
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 18 Mar 2015 17:14:59 +0000 (18:14 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 19 Mar 2015 11:37:37 +0000 (12:37 +0100)
* this needs improvement: code should be put in a separate function of
(ldap?) email user plugin

Change-Id: Ic04e9189699c444883a94a11a34dc65b5c17c8db
Reviewed-on: http://gerrit.tine20.com/customers/1747
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User/Plugin/LdapAbstract.php
tine20/Tinebase/User/Plugin/Samba.php

index 0c07532..de72ba9 100644 (file)
@@ -92,23 +92,27 @@ abstract class Tinebase_User_Plugin_LdapAbstract implements Tinebase_User_Plugin
         if (! $_user instanceof Tinebase_Model_FullUser) {
             return;
         }
-
-        $emailUser = $this->_ldap2User($_user, $_ldapEntry);
         
-        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($emailUser->toArray(), TRUE));
+        $user = $this->_ldap2User($_user, $_ldapEntry);
         
-        // modify/correct user name
-        // set emailUsername to Tine 2.0 account login name and append domain for login purposes if set
-        if (empty($emailUser->emailUsername)) {
-            $emailUser->emailUsername = $this->_getEmailUserName($_user);
-        }
+        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($user->toArray(), TRUE));
         
-        if ($this instanceof Tinebase_EmailUser_Smtp_Interface) {
-            $_user->smtpUser  = $emailUser;
-            $_user->emailUser = Tinebase_EmailUser::merge($_user->emailUser, clone $_user->smtpUser);
-        } else {
-            $_user->imapUser  = $emailUser;
-            $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, $_user->emailUser);
+        if ($this instanceof Tinebase_EmailUser_Ldap) {
+            // TODO this should be moved to Tinebase_EmailUser_Ldap
+            
+            // modify/correct user name
+            // set emailUsername to Tine 2.0 account login name and append domain for login purposes if set
+            if (empty($user->emailUsername)) {
+                $user->emailUsername = $this->_getEmailUserName($_user);
+            }
+            
+            if ($this instanceof Tinebase_EmailUser_Smtp_Interface) {
+                $_user->smtpUser  = $user;
+                $_user->emailUser = Tinebase_EmailUser::merge($_user->emailUser, clone $_user->smtpUser);
+            } else {
+                $_user->imapUser  = $user;
+                $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, $_user->emailUser);
+            }
         }
     }
     
index 4e969d1..589e865 100644 (file)
@@ -140,6 +140,7 @@ class Tinebase_User_Plugin_Samba  extends Tinebase_User_Plugin_LdapAbstract
      *
      * @param  Tinebase_Model_User  $_user
      * @param  array                $_ldapEntry
+     * @return Tinebase_Model_User
      */
     protected function _ldap2User(Tinebase_Model_User $_user, array &$_ldapEntry)
     {
@@ -168,6 +169,8 @@ class Tinebase_User_Plugin_Samba  extends Tinebase_User_Plugin_LdapAbstract
         }
         
         $_user->sambaSAM = new Tinebase_Model_SAMUser($accountArray);
+        
+        return $_user;
     }
     
     /**