@@ -3049,22 +3049,24 @@ private function getAddressbookDir() {
30493049 private function isGSyncEnabled () {
30503050 $ addressbook = $ this ->getAddressbook ();
30513051 // this check needs to be performed on the store of the main (authenticated) user
3052- $ store = $ this ->storeCache [$ this ->mainUser ];
3053- $ userEntryid = mapi_getprops ($ store , [PR_MAILBOX_OWNER_ENTRYID ]);
3054- $ mailuser = mapi_ab_openentry ($ addressbook , $ userEntryid [PR_MAILBOX_OWNER_ENTRYID ]);
3055- $ enabledFeatures = mapi_getprops ($ mailuser , [PR_EC_DISABLED_FEATURES ]);
3056- if (isset ($ enabledFeatures [PR_EC_DISABLED_FEATURES ]) && is_array ($ enabledFeatures [PR_EC_DISABLED_FEATURES ])) {
3057- $ mobileDisabled = in_array (self ::MOBILE_ENABLED , $ enabledFeatures [PR_EC_DISABLED_FEATURES ]);
3058- $ deviceId = Request::GetDeviceID ();
3059- // Checks for deviceId present in zarafaDisabledFeatures LDAP array attribute. Check is performed case insensitive.
3060- $ deviceIdDisabled = (($ deviceId !== null ) && in_array ($ deviceId , array_map ('strtolower ' , $ enabledFeatures [PR_EC_DISABLED_FEATURES ]))) ? true : false ;
3061- if ($ mobileDisabled ) {
3062- throw new FatalException ("User is disabled for grommunio-sync. " );
3063- }
3064- if ($ deviceIdDisabled ) {
3065- throw new FatalException (sprintf ("User has deviceId %s disabled for usage with grommunio-sync. " , $ deviceId ));
3052+ $ storeProps = mapi_getprops ($ this ->storeCache [$ this ->mainUser ], [PR_MAILBOX_OWNER_ENTRYID , PR_EC_ENABLED_FEATURES_L ]);
3053+ $ mobileDisabled = !($ storeProps [PR_EC_ENABLED_FEATURES_L ] & UP_EAS );
3054+ if (!$ mobileDisabled ) {
3055+ $ mailuser = mapi_ab_openentry ($ addressbook , $ userEntryid [PR_MAILBOX_OWNER_ENTRYID ]);
3056+ $ enabledFeatures = mapi_getprops ($ mailuser , [PR_EC_DISABLED_FEATURES ]);
3057+ if (isset ($ enabledFeatures [PR_EC_DISABLED_FEATURES ]) && is_array ($ enabledFeatures [PR_EC_DISABLED_FEATURES ])) {
3058+ $ mobileDisabled = in_array (self ::MOBILE_ENABLED , $ enabledFeatures [PR_EC_DISABLED_FEATURES ]);
3059+ $ deviceId = Request::GetDeviceID ();
3060+ // Checks for deviceId present in zarafaDisabledFeatures LDAP array attribute. Check is performed case insensitive.
3061+ $ deviceIdDisabled = (($ deviceId !== null ) && in_array ($ deviceId , array_map ('strtolower ' , $ enabledFeatures [PR_EC_DISABLED_FEATURES ]))) ? true : false ;
3062+ if ($ deviceIdDisabled ) {
3063+ throw new FatalException (sprintf ("User has deviceId %s disabled for usage with grommunio-sync. " , $ deviceId ));
3064+ }
30663065 }
30673066 }
3067+ if ($ mobileDisabled ) {
3068+ throw new FatalException ("User is disabled for grommunio-sync. " );
3069+ }
30683070
30693071 return true ;
30703072 }
0 commit comments