diff --git a/lib/classes/JsonApi/Routes/Files/Authority.php b/lib/classes/JsonApi/Routes/Files/Authority.php index 437b558edbe1f05efc099e3e603f8e3f93ac7eee..8f25bb6cc914aede63582812e9e918b456671aad 100644 --- a/lib/classes/JsonApi/Routes/Files/Authority.php +++ b/lib/classes/JsonApi/Routes/Files/Authority.php @@ -21,14 +21,16 @@ class Authority return false; } - $info = \PluginManager::getInstance()->getPluginInfo('CodeDocuments'); - if (!\PluginManager::getInstance()->isPluginActivated($info['id'], $resource->getId())) { - return false; + if ($resource instanceof \Course || $resource instanceof \Institute) { + $info = \PluginManager::getInstance()->getPluginInfo('CoreDocuments'); + if (!\PluginManager::getInstance()->isPluginActivated($info['id'], $resource->id)) { + return false; + } } - return ($folder = \Folder::findTopFolder($resource->getId())) && + return ($folder = \Folder::findTopFolder($resource->id)) && ($rootFolder = $folder->getTypedFolder()) && - $rootFolder->isVisible($user->getId()); + $rootFolder->isVisible($user->id); } public static function canShowFolder(User $user, \FolderType $folder)