Commit 7c2f3a25 authored by mku's avatar mku

ZP-269 #comment Look for enabled/disabled z-push feature in ZCP

git-svn-id: https://z-push.org/svn/z-push/trunk@1923 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 03e04d87
...@@ -1165,6 +1165,15 @@ define('PR_EC_STATS_SESSION_LOCKED' ,mapi_prop_tag(PT_BOOLEAN, ...@@ -1165,6 +1165,15 @@ define('PR_EC_STATS_SESSION_LOCKED' ,mapi_prop_tag(PT_BOOLEAN,
define('PR_EC_STATS_SESSION_BUSYSTATES' ,mapi_prop_tag(PT_MV_STRING8, PR_EC_BASE+0x47)); define('PR_EC_STATS_SESSION_BUSYSTATES' ,mapi_prop_tag(PT_MV_STRING8, PR_EC_BASE+0x47));
define('PR_EC_COMPANY_NAME' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x48)); define('PR_EC_COMPANY_NAME' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x48));
/* user features */
define('PR_EC_ENABLED_FEATURES' ,mapi_prop_tag(PT_MV_TSTRING, PR_EC_BASE+0xB3));
define('PR_EC_ENABLED_FEATURES_A' ,mapi_prop_tag(PT_MV_STRING8, PR_EC_BASE+0xB3));
define('PR_EC_ENABLED_FEATURES_W' ,mapi_prop_tag(PT_MV_UNICODE, PR_EC_BASE+0xB3));
define('PR_EC_DISABLED_FEATURES' ,mapi_prop_tag(PT_MV_TSTRING, PR_EC_BASE+0xB4));
define('PR_EC_DISABLED_FEATURES_A' ,mapi_prop_tag(PT_MV_STRING8, PR_EC_BASE+0xB4));
define('PR_EC_DISABLED_FEATURES_W' ,mapi_prop_tag(PT_MV_UNICODE, PR_EC_BASE+0xB4));
/* WA properties */ /* WA properties */
define('PR_EC_WA_ATTACHMENT_HIDDEN_OVERRIDE' ,mapi_prop_tag(PT_BOOLEAN, PR_EC_BASE+0xE0)); define('PR_EC_WA_ATTACHMENT_HIDDEN_OVERRIDE' ,mapi_prop_tag(PT_BOOLEAN, PR_EC_BASE+0xE0));
......
...@@ -91,6 +91,9 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -91,6 +91,9 @@ class BackendZarafa implements IBackend, ISearchProvider {
private $wastebasket; private $wastebasket;
private $addressbook; private $addressbook;
// ZCP config parameter for PR_EC_ENABLED_FEATURES / PR_EC_DISABLED_FEATURES
const ZPUSH_ENABLED = 'mobile';
/** /**
* Constructor of the Zarafa Backend * Constructor of the Zarafa Backend
* *
...@@ -200,6 +203,8 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -200,6 +203,8 @@ class BackendZarafa implements IBackend, ISearchProvider {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->Logon(): User '%s' is authenticated",$user)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->Logon(): User '%s' is authenticated",$user));
$this->isZPushEnabled();
// check if this is a Zarafa 7 store with unicode support // check if this is a Zarafa 7 store with unicode support
MAPIUtils::IsUnicodeStore($this->store); MAPIUtils::IsUnicodeStore($this->store);
return true; return true;
...@@ -1850,6 +1855,25 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1850,6 +1855,25 @@ class BackendZarafa implements IBackend, ISearchProvider {
} }
return $this->addressbook; return $this->addressbook;
} }
/**
* Checks if the user is not disabled for Z-Push.
*
* @access private
* @throws FatalException if user is disabled for Z-Push
*
* @return boolean
*/
private function isZPushEnabled() {
$addressbook = $this->getAddressbook();
$userEntryid = mapi_getprops($this->store, array(PR_MAILBOX_OWNER_ENTRYID));
$mailuser = mapi_ab_openentry($addressbook, $userEntryid[PR_MAILBOX_OWNER_ENTRYID]);
$enabledFeatures = mapi_getprops($mailuser, array(PR_EC_DISABLED_FEATURES));
if (isset($enabledFeatures[PR_EC_DISABLED_FEATURES]) && is_array($enabledFeatures[PR_EC_DISABLED_FEATURES]) && in_array(self::ZPUSH_ENABLED, $enabledFeatures[PR_EC_DISABLED_FEATURES])) {
throw new FatalException("User is disabled for Z-Push.");
}
return true;
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment