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
This commit is contained in:
Morris Jobke 2015-12-10 14:53:34 +01:00
parent df15d54db6
commit f5e6c75804

View file

@ -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) {