catch preferences error when user has no app run right
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 30 Aug 2016 14:19:21 +0000 (16:19 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 2 Sep 2016 11:14:29 +0000 (13:14 +0200)
... as we add app registry even if user has just one right
 for the app

Change-Id: I633c51c5638b8cc1f82c0f9cc96e678231ef068f
Reviewed-on: http://gerrit.tine20.com/customers/3499
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Frontend/Json.php

index 4985e08..a56b230 100644 (file)
@@ -826,7 +826,7 @@ class Tinebase_Frontend_Json extends Tinebase_Frontend_Json_Abstract
         $registryData = array();
         
         if (Tinebase_Core::getUser()) {
-            $userApplications = Tinebase_Core::getUser()->getApplications(TRUE);
+            $userApplications = Tinebase_Core::getUser()->getApplications(/* $_anyRight */ TRUE);
             $clientConfig = Tinebase_Config::getInstance()->getClientRegistryConfig();
             
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE))
@@ -860,8 +860,12 @@ class Tinebase_Frontend_Json extends Tinebase_Frontend_Json_Abstract
                 $appRegistry['customfields'] = $customfields->toArray();
 
                 // add preferences for app
-                $prefRegistry = $this->_getAppPreferencesForRegistry($application);
-                $appRegistry = array_merge_recursive($appRegistry, $prefRegistry);
+                try {
+                    $prefRegistry = $this->_getAppPreferencesForRegistry($application);
+                    $appRegistry = array_merge_recursive($appRegistry, $prefRegistry);
+                } catch (Tinebase_Exception_AccessDenied $tead) {
+                    // do not add prefs if user has no run right
+                }
 
                 $customAppRegistry = $this->_getCustomAppRegistry($application);
                 if (empty($customAppRegistry)) {