Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 9 Dec 2014 14:45:18 +0000 (15:45 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 9 Dec 2014 14:45:18 +0000 (15:45 +0100)
Conflicts:
tine20/Calendar/Frontend/WebDAV/Event.php
tine20/Tinebase/Config.php
tine20/Tinebase/Container.php
tine20/Tinebase/Core.php
tine20/Tinebase/User/Abstract.php

Change-Id: I802c8cb9d54ad4dbf43f0bc0f8d5645d399b84f1

13 files changed:
1  2 
tests/tine20/Calendar/Controller/MSEventFacadeTest.php
tests/tine20/Courses/JsonTest.php
tine20/Admin/Controller/User.php
tine20/Admin/Import/User/Csv.php
tine20/Calendar/Frontend/WebDAV/Event.php
tine20/Calendar/Model/Attender.php
tine20/Courses/Controller/Course.php
tine20/Courses/Setup/Initialize.php
tine20/Tinebase/Config.php
tine20/Tinebase/Container.php
tine20/Tinebase/Core.php
tine20/Tinebase/Model/FullUser.php
tine20/Tinebase/User/Abstract.php

Simple merge
Simple merge
Simple merge
@@@ -58,16 -58,7 +58,14 @@@ class Calendar_Frontend_WebDAV_Event ex
              $this->_event = ($pos = strpos($this->_event, '.')) === false ? $this->_event : substr($this->_event, 0, $pos);
          }
          
 +        if (isset($_SERVER['HTTP_USER_AGENT'])) {
 +            list($backend, $version) = Calendar_Convert_Event_VCalendar_Factory::parseUserAgent($_SERVER['HTTP_USER_AGENT']);
 +        } else {
 +            $backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC;
 +            $version = null;
 +        }
 +        
          Calendar_Controller_MSEventFacade::getInstance()->assertEventFacadeParams($this->_container);
-         
-         $this->_converter = Calendar_Convert_Event_VCalendar_Factory::factory($backend, $version);
      }
      
      /**
Simple merge
Simple merge
Simple merge
@@@ -287,20 -287,13 +287,27 @@@ class Tinebase_Config extends Tinebase_
      const ALARMS_EACH_JOB = 'alarmsEachJob';
      
      /**
 +     * ACCOUNT_DEACTIVATION_NOTIFICATION
 +     *
 +     * @var string
 +     */
 +    const ACCOUNT_DEACTIVATION_NOTIFICATION = 'accountDeactivationNotification';
 +    
 +    /**
 +     * roleChangeAllowed
 +     *
 +     * @var string
 +     */
 +    const ROLE_CHANGE_ALLOWED = 'roleChangeAllowed';
 +    
 +    /**
+      * max username length
+      *
+      * @var string
+      */
+     const MAX_USERNAME_LENGTH = 'max_username_length';
+     
+     /**
       * (non-PHPdoc)
       * @see tine20/Tinebase/Config/Definition::$_properties
       */
              'setByAdminModule'      => FALSE,
              'setBySetupModule'      => TRUE,
          ),
 +        self::ACCOUNT_DEACTIVATION_NOTIFICATION => array(
 +            //_('Account deactivation notfication')
 +            'label'                 => 'Account deactivation notfication',
 +            //_('Send E-Mail to user if the account is deactivated or the user tries to login with deactivated account')
 +            'description'           => 'Send E-Mail to User if the account is deactivated or the user tries to login with deactivated account',
 +            'type'                  => 'bool',
 +            'clientRegistryInclude' => FALSE,
 +            'setByAdminModule'      => FALSE,
 +            'setBySetupModule'      => TRUE,
 +        ),
 +        self::ROLE_CHANGE_ALLOWED => array(
 +                                   //_('Role change allowed')
 +            'label'                 => 'Role change allowed',
 +                                   //_('Allows to configure which user is allowed to switch to another users account')
 +            'description'           => 'Allows to configure which user is allowed to switch to another users account',
 +            'type'                  => 'Tinebase_Config_Struct',
 +            'clientRegistryInclude' => TRUE,
 +            'setByAdminModule'      => FALSE,
 +            'setBySetupModule'      => TRUE,
+         self::MAX_USERNAME_LENGTH => array(
+                 //_('Max username length')
+                 'label'                 => 'Max username length',
+                 //_('Max username length')
+                 'description'           => 'Max username length',
+                 'type'                  => 'int',
+                 'default'               => NULL,
+                 'clientRegistryInclude' => FALSE,
          ),
      );
      
@@@ -730,13 -726,9 +733,12 @@@ class Tinebase_Container extends Tineba
       * @return  Tinebase_Record_RecordSet set of Tinebase_Model_Container
       * @throws  Tinebase_Exception_NotFound
       */
 -    public function getSharedContainer($_accountId, $_application, $_grant, $_ignoreACL = FALSE)
 +    public function getSharedContainer($_accountId, $recordClass, $_grant, $_ignoreACL = FALSE)
      {
 -        $application = Tinebase_Application::getInstance()->getApplicationByName($_application);
 +        // legacy handling
 +        $meta = $this->_resolveRecordClassArgument($recordClass);
-         
-         $accountId   = Tinebase_Model_User::convertUserIdToInt($_accountId);
 +        $application = Tinebase_Application::getInstance()->getApplicationByName($meta['appName']);
++        
          $grant       = $_ignoreACL ? '*' : $_grant;
          
          $select = $this->_getSelect()
@@@ -173,11 -176,13 +173,18 @@@ class Tinebase_Cor
      protected static $appInstanceCache = array();
      
      /**
 -    
 +     * current cache status, maybe NULL / uninitialized, true / enabled, false / disabled
 +     * @var boolean
 +     */
 +    protected static $cacheStatus = NULL;
 +    
++    /**
+      * variable to cache value of logLevel during request
+      * 
+      * @var int
+      */
+     protected static $logLevel;
+     
      /******************************* DISPATCH *********************************/
      
      /**
       */
      public static function get($index)
      {
-         return (Zend_Registry::isRegistered($index)) ? Zend_Registry::get($index) : NULL;
+         try {
+             return Zend_Registry::get($index);
+         } catch (Zend_Exception $ze) {
+             return null;
+         }
      }
 -
 +    
      /**
       * set a registry value
       * 
          }
          return self::get(self::CONFIG);
      }
 -
 +    
 +    /**
++<<<<<<< HEAD
 +     * get max configured loglevel
 +     * 
 +     * @return integer
 +     */
 +    public static function getLogLevel()
 +    {
 +        if (! ($logLevel = self::get(self::LOGLEVEL))) {
 +            $config = self::getConfig();
 +            $logLevel = Tinebase_Log::getMaxLogLevel(isset($config->logger) ? $config->logger : NULL);
 +            self::set(self::LOGLEVEL, $logLevel);
 +        }
 +        
 +        return $logLevel;
 +    }
 +    
      /**
++=======
++>>>>>>> 2013.10
       * check if given loglevel should be logged
       * 
       * @param  integer $_prio
Simple merge
@@@ -341,16 -341,18 +341,18 @@@ abstract class Tinebase_User_Abstract i
       * @param integer $_schema 0 = lastname (10 chars) / 1 = lastname + 2 chars of firstname / 2 = 1-x chars of firstname + lastname 
       * @return string
       */
-     public function generateUserName($_account, $_schema = 1)
+     public function generateUserName($_account, $_schema = 1, $_length = NULL)
      {
-         if (! empty($_account->accountFirstName) && $_schema > 0) {
-             if (method_exists($this, '_generateUserWithSchema' . $_schema)) {
-                 $userName = call_user_func_array(array($this, '_generateUserWithSchema' . $_schema), array($_account));
-             } else {
-                 $userName = strtolower(substr(Tinebase_Helper::replaceSpecialChars($_account->accountLastName), 0, 10));
-             }
+         if (! empty($_account->accountFirstName) && $_schema > 0 && method_exists($this, '_generateUserWithSchema' . $_schema)) {
+             $userName = call_user_func_array(array($this, '_generateUserWithSchema' . $_schema), array($_account));
+         } else {
 -            $userName = strtolower(substr(replaceSpecialChars($_account->accountLastName), 0, 10));
++            $userName = strtolower(substr(Tinebase_Helper::replaceSpecialChars($_account->accountLastName), 0, 10));
+         }
+         
+         if (!empty($_length) && (strlen($userName) > $_length)) {
+             $userName = substr($userName, 0, $_length);
          }
-         $userName = $this->_addSuffixToNameIfExists('accountLoginName', $userName);
+         $userName = $this->_addSuffixToNameIfExists('accountLoginName', $userName, $_length);
          
          if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . '  generated username: ' . $userName);