Code

Updated feature detection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Sep 2010 08:41:41 +0000 (08:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Sep 2010 08:41:41 +0000 (08:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19558 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_groupware.inc

index f56b826f44a8582efc1f2ca7b21d88f0d9b37af7..9ac0c6271697a8e03da23776d7329999ee2336cb 100644 (file)
@@ -33,19 +33,7 @@ class groupware extends plugin
             "dropOwnMails"
             );
 
-    var $enabledFeatures = array(
-            "quotaUsage"                => TRUE,
-            "quotaSize"                 => TRUE,
-            "mailFilter"                => TRUE,
-            "alternateAddresses"        => TRUE,
-            "forwardingAddresses"       => TRUE,
-            "vacationMessage"           => TRUE,
-            "mailBoxWarnLimit"          => TRUE,
-            "mailBoxSendSizelimit"      => TRUE,
-            "mailBoxHardSizelimit"      => TRUE,
-            "mailBoxAutomaticRemoval"   => TRUE,
-            "localDeliveryOnly"         => TRUE,
-            "dropOwnMails"              => TRUE);
+    var $enabledFeatures = array();
 
     var $flagAttributes = array("vacationEnabled","mailBoxWarnLimitEnabled","mailBoxSendSizelimitEnabled",
             "mailBoxHardSizelimitEnabled","mailBoxAutomaticRemovalEnabled","localDeliveryOnly","dropOwnMails");
@@ -122,6 +110,45 @@ class groupware extends plugin
      */
     function init()
     {
+        // Detect feature availability and enable/disable services correspondingly.
+        $features = $this->rpcExec('gwGetCapabilities');
+        $featureReq = array(
+                "quotaUsage"                => array(
+                    'acctGetQuota'),
+                "quotaSize"                 => array(
+                    'acctSetQuota','acctGetQuota'),
+                "mailFilter"                => array(
+                    'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
+                "alternateAddresses"        => array(
+                    'acctDelAlternateMailAddress','acctSetAlternateMailAddresses',
+                    'acctAddAlternateMailAddress','acctGetAlternateMailAddresses'),
+                "forwardingAddresses"       => array(
+                    'acctAddMailForwardAddress','acctDelMailForwardAddress',
+                    'acctGetMailForwardAddresses','acctSetMailForwardAddresses'),
+                "vacationMessage"           => array(
+                    'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
+                "mailBoxWarnLimit"          => array(
+                    'acctSetQuota','acctGetQuota'),
+                "mailBoxSendSizelimit"      => array(
+                    'acctSetQuota','acctGetQuota'),
+                "mailBoxHardSizelimit"      => array(
+                    'acctSetQuota','acctGetQuota'),
+                "mailBoxAutomaticRemoval"   => array(
+                        'acctSetQuota','acctGetQuota'),
+                "localDeliveryOnly"         => array(
+                        'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
+                "dropOwnMails"              => array(
+                        'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'));
+       
+        foreach($featureReq as $name => $requires){
+            $active = TRUE;
+            foreach($requires as $methodName){
+                $active &= $features[$methodName];
+            }
+            $this->enabledFeatures[$name] = $active;
+        }
+
         // Get rpc handle to fetch account info and feature availability.
         $status = $this->rpcExec('gwAcctExists', $this->uid);
         if($status !== NULL){
@@ -148,6 +175,10 @@ class groupware extends plugin
         // Register plugin execution 
         $display = plugin::execute();
 
+        
+        $this->accountInitialized = FALSE;
+
+
         // Log plugin execution.
         if($this->is_account && !$this->view_logged){
             $this->view_logged = TRUE;