summaryrefslogtreecommitdiffstats
path: root/lib/private/app/appmanager.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-12-10 14:53:34 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-12-10 14:53:34 +0100
commitf5e6c7580487ed853f67c0bee556a79a52ceb1ac (patch)
treec417a8cd244e1517b695395fa1c3eaab83d0ca68 /lib/private/app/appmanager.php
parentdf15d54db65a692f2ecf9307ae2a9b43c8fe0697 (diff)
downloadnextcloud-server-f5e6c7580487ed853f67c0bee556a79a52ceb1ac.tar.gz
nextcloud-server-f5e6c7580487ed853f67c0bee556a79a52ceb1ac.zip
Make AppManager->checkAppForUser more robust
* if the JSON that is stored in the DB is corrupt an error was thrown * with this change it is properly handled and the app is disabled
Diffstat (limited to 'lib/private/app/appmanager.php')
-rw-r--r--lib/private/app/appmanager.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php
index f826c8ba0c7..8ae93f98832 100644
--- a/lib/private/app/appmanager.php
+++ b/lib/private/app/appmanager.php
@@ -148,6 +148,13 @@ class AppManager implements IAppManager {
return false;
} else {
$groupIds = json_decode($enabled);
+
+ if (!is_array($groupIds)) {
+ $jsonError = json_last_error();
+ \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
+ return false;
+ }
+
$userGroups = $this->groupManager->getUserGroupIds($user);
foreach ($userGroups as $groupId) {
if (array_search($groupId, $groupIds) !== false) {