fetch full user from sql to avoid ldap lookups
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 1 Sep 2014 14:50:33 +0000 (16:50 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 2 Sep 2014 14:56:51 +0000 (16:56 +0200)
Change-Id: Ia9ae5e2f08320b37e5926104c6796ab775694cda
Reviewed-on: http://gerrit.tine20.com/customers/1078
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/EmailUser/Sql.php
tine20/Tinebase/Frontend/Cli.php
tine20/Tinebase/Model/Tree/Node/Path.php
tine20/Tinebase/WebDav/Container/Abstract.php
tine20/Tinebase/WebDav/Plugin/Inverse.php

index 5671020..4788bb2 100644 (file)
@@ -343,7 +343,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         
         $userId = $queryResult['userid'];
         try {
-            Tinebase_User::getInstance()->getFullUserById($userId);
+            Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $userId);
             throw new Tinebase_Exception_SystemGeneric('Could not overwrite existing email user.');
         } catch (Tinebase_Exception_NotFound $tenf) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Delete obsolete email user ' .$userId);
index 0b81a0a..f8e4617 100644 (file)
@@ -138,7 +138,7 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
         try {
             $cronuserId = Tinebase_Config::getInstance()->get(Tinebase_Config::CRONUSERID);
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Setting user with id ' . $cronuserId . ' as cronuser.');
-            $cronuser = Tinebase_User::getInstance()->getFullUserById($cronuserId);
+            $cronuser = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $cronuserId, 'Tinebase_Model_FullUser');
         } catch (Tinebase_Exception_NotFound $tenf) {
             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' ' . $tenf->getMessage());
             
index ea9151d..ca6646d 100644 (file)
@@ -365,10 +365,11 @@ class Tinebase_Model_Tree_Node_Path extends Tinebase_Record_Abstract
             // replace account login name with id
             if ($this->containerOwner) {
                 try {
-                    $pathParts[3] = Tinebase_User::getInstance()->getFullUserByLoginName($this->containerOwner)->getId();
+                    $pathParts[3] = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $this->containerOwner, 'Tinebase_Model_FullUser')->getId();
                 } catch (Tinebase_Exception_NotFound $tenf) {
                     // try again with id
-                    $user = Tinebase_User::getInstance()->getFullUserById($this->containerOwner);
+                    $accountId = is_object($this->containerOwner) ? $this->containerOwner->getId() : $this->containerOwner;
+                    $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $accountId, 'Tinebase_Model_FullUser');
                     $pathParts[3] = $user->getId();
                     $this->containerOwner = $user->accountLoginName;
                 }
@@ -423,7 +424,7 @@ class Tinebase_Model_Tree_Node_Path extends Tinebase_Record_Abstract
         $this->containerType        = $container->type;
         $ownerAccountId             = Tinebase_Container::getInstance()->getContainerOwner($container);
         if ($ownerAccountId) {
-            $this->containerOwner = Tinebase_User::getInstance()->getFullUserById($ownerAccountId)->accountLoginName;
+            $this->containerOwner = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $ownerAccountId, 'Tinebase_Model_FullUser')->accountLoginName;
         } else if ($this->containerType === Tinebase_Model_Container::TYPE_PERSONAL) {
             throw new Tinebase_Exception_InvalidArgument('Personal container needs an owner!');
         } else {
index 87c4d7c..5a984b2 100644 (file)
@@ -208,7 +208,7 @@ abstract class Tinebase_WebDav_Container_Abstract extends Sabre\DAV\Collection i
                     
                 case Tinebase_Acl_Rights::ACCOUNT_TYPE_USER:
                     try {
-                        $fulluser = Tinebase_User::getInstance()->getFullUserById($grant->account_id);
+                        $fulluser = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $grant->account_id, 'Tinebase_Model_FullUser');
                     } catch (Tinebase_Exception_Record_NotDefined $ternd) {
                         // skip group
                         continue 2;
index 72f8e8d..3b83218 100644 (file)
@@ -341,7 +341,7 @@ class Tinebase_WebDav_Plugin_Inverse extends Sabre\DAV\ServerPlugin {
                 switch($value['account_type']) {
                     case Tinebase_Acl_Rights::ACCOUNT_TYPE_USER:
                         try {
-                            $account = Tinebase_User::getInstance()->getFullUserById($value['account_id']);
+                            $account = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $value['account_id'], 'Tinebase_Model_FullUser');
                         } catch (Tinebase_Exception_NotFound $e) {
                             $account = Tinebase_User::getInstance()->getNonExistentUser();
                         }