Commit 1b69b73d authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #305 in ZP/z-push from...

Merge pull request #305 in ZP/z-push from feature/ZP-993-allow-to-disable-outlook-access-from to develop

* commit 'a876083b':
  ZP-993 Allow to disable outlook and mobile devices' access separately.
parents 3bdca761 a876083b
......@@ -75,7 +75,8 @@ class BackendKopano implements IBackend, ISearchProvider {
private $folderStatCache;
// KC config parameter for PR_EC_ENABLED_FEATURES / PR_EC_DISABLED_FEATURES
const ZPUSH_ENABLED = 'mobile';
const MOBILE_ENABLED = 'mobile';
const OUTLOOK_ENABLED = 'outlook';
const MAXAMBIGUOUSRECIPIENTS = 9999;
const FREEBUSYENUMBLOCKS = 50;
......@@ -2323,8 +2324,18 @@ class BackendKopano implements IBackend, ISearchProvider {
$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.");
if (isset($enabledFeatures[PR_EC_DISABLED_FEATURES]) && is_array($enabledFeatures[PR_EC_DISABLED_FEATURES])) {
$mobileDisabled = in_array(self::MOBILE_ENABLED, $enabledFeatures[PR_EC_DISABLED_FEATURES]);
$outlookDisabled = in_array(self::OUTLOOK_ENABLED, $enabledFeatures[PR_EC_DISABLED_FEATURES]);
if ($mobileDisabled && $outlookDisabled) {
throw new FatalException("User is disabled for Z-Push.");
}
elseif (Request::IsOutlook() && $outlookDisabled) {
throw new FatalException("User is disabled for Outlook usage with Z-Push.");
}
elseif (!Request::IsOutlook() && $mobileDisabled) {
throw new FatalException("User is disabled for mobile device usage with 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