Merge branch '2013.10' into 2014.11
[tine20] / tine20 / Tinebase / Config.php
index a72c9da..20ac750 100644 (file)
@@ -5,7 +5,7 @@
  * @package     Tinebase
  * @subpackage  Config
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
- * @copyright   Copyright (c) 2007-2012 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Philipp Schüle <p.schuele@metaways.de>
  * 
  */
@@ -301,12 +301,40 @@ class Tinebase_Config extends Tinebase_Config_Abstract
     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';
-    
+
+    /**
+     * conf.d folder name
+     *
+     * @var string
+     */
+    const CONFD_FOLDER = 'confdfolder';
+
+    /**
+     * maintenance mode
+     *
+     * @var bool
+     */
+    const MAINTENANCE_MODE = 'maintenanceMode';
+
     /**
      * (non-PHPdoc)
      * @see tine20/Tinebase/Config/Definition::$_properties
@@ -693,6 +721,26 @@ class Tinebase_Config extends Tinebase_Config_Abstract
             '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',
@@ -702,6 +750,28 @@ class Tinebase_Config extends Tinebase_Config_Abstract
                 'default'               => NULL,
                 'clientRegistryInclude' => FALSE,
         ),
+        self::CONFD_FOLDER => array(
+            //_('conf.d folder name')
+            'label'                 => 'conf.d folder name',
+            //_('Folder for additional config files (conf.d) - NOTE: this is only used if set in config.inc.php!')
+            'description'           => 'Folder for additional config files (conf.d) - NOTE: this is only used if set in config.inc.php!',
+            'type'                  => 'string',
+            'default'               => '',
+            'clientRegistryInclude' => FALSE,
+            'setByAdminModule'      => FALSE,
+            'setBySetupModule'      => FALSE,
+        ),
+        self::MAINTENANCE_MODE => array(
+            //_('Maintenance mode enabled')
+            'label'                 => 'Maintenance mode enabled',
+            //_('Folder for additional config files (conf.d) - NOTE: this is only used if set in config.inc.php!')
+            'description'           => 'Installation is in maintenance mode. With this only users having the maintenance right can login',
+            'type'                  => 'bool',
+            'default'               => '',
+            'clientRegistryInclude' => FALSE,
+            'setByAdminModule'      => TRUE,
+            'setBySetupModule'      => TRUE,
+        ),
     );
     
     /**
@@ -763,7 +833,6 @@ class Tinebase_Config extends Tinebase_Config_Abstract
     {
         // get all config names to be included in registry
         $clientProperties = new Tinebase_Config_Struct(array());
-        $filters = array();
         $userApplications = Tinebase_Core::getUser()->getApplications(TRUE);
         foreach ($userApplications as $application) {
             $config = Tinebase_Config_Abstract::factory($application->name);
@@ -775,15 +844,21 @@ class Tinebase_Config extends Tinebase_Config_Abstract
                     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ 
                         . ' ' . print_r($definition, TRUE));
                     
-                    if ((isset($definition['clientRegistryInclude']) || array_key_exists('clientRegistryInclude', $definition)) && $definition['clientRegistryInclude'] === TRUE) {
+                    if ((isset($definition['clientRegistryInclude']) || array_key_exists('clientRegistryInclude', $definition))
+                        && $definition['clientRegistryInclude'] === TRUE)
+                    {
                         // add definition here till we have a better place
-                        $configRegistryItem = new Tinebase_Config_Struct(array(
-                            'value'         => $config->{$name},
-                            'definition'    => new Tinebase_Config_Struct($definition),
-                        ));
-                        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ 
-                            . ' ' . print_r($configRegistryItem->toArray(), TRUE));
-                        $clientProperties[$application->name][$name] = $configRegistryItem;
+                        try {
+                            $configRegistryItem = new Tinebase_Config_Struct(array(
+                                'value' => $config->{$name},
+                                'definition' => new Tinebase_Config_Struct($definition),
+                            ));
+                            if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                                . ' ' . print_r($configRegistryItem->toArray(), TRUE));
+                            $clientProperties[$application->name][$name] = $configRegistryItem;
+                        } catch (Exception $e) {
+                            Tinebase_Exception::log($e);
+                        }
                     }
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
@@ -834,5 +909,5 @@ class Tinebase_Config extends Tinebase_Config_Abstract
         $result = (isset($option[$_label])) ? $option[$_label] : '';
         
         return $result;
-    }    
+    }
 }