From ce9461f900b818e3db7f1cc95b55637bf925c889 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 8 Sep 2010 08:41:41 +0000 Subject: [PATCH] Updated feature detection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19558 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/groupware/class_groupware.inc | 57 ++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/gosa-plugins/groupware/personal/groupware/class_groupware.inc b/gosa-plugins/groupware/personal/groupware/class_groupware.inc index f56b826f4..9ac0c6271 100644 --- a/gosa-plugins/groupware/personal/groupware/class_groupware.inc +++ b/gosa-plugins/groupware/personal/groupware/class_groupware.inc @@ -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; -- 2.30.2