diff --git a/app/controllers/files.php b/app/controllers/files.php index 5181f974a36e0c6f418bb9c9ab2f1802746ef42d..bfc2e98af1096a810650ad9e1b868a51647d4697 100644 --- a/app/controllers/files.php +++ b/app/controllers/files.php @@ -387,10 +387,12 @@ class FilesController extends AuthenticatedController $this->all_files = []; $count_visible = 0; foreach ($all_file_refs as $file_ref) { - $vue_data = FilesystemVueDataManager::getFileVueData( - $file_ref->getFileType(), - $this->topFolder - ); + if ($file_ref->getFileType()->isVisible($GLOBALS['user']->id)) { + $vue_data = FilesystemVueDataManager::getFileVueData( + $file_ref->getFileType(), + $this->topFolder + ); + } if (isset($vue_data['download_url'])) { $this->all_files[] = $vue_data; if (++$count_visible === 5) break; @@ -471,7 +473,6 @@ class FilesController extends AuthenticatedController //] $folders = []; $new_file_refs = FileRef::findAll($GLOBALS['user']->id, $this->begin, $this->end, $this->course_id, $this->page_size, $offset); - //Group the file refs by their folder: foreach ($new_file_refs as $file_ref) { if (!is_array($folders[$file_ref->folder_id])) { diff --git a/lib/classes/globalsearch/GlobalSearchFiles.php b/lib/classes/globalsearch/GlobalSearchFiles.php index 7d36860a00dc64f02bb32f120fa451cd91292c08..e0cd9f4356faad82edfb532211a53f60224ab2d3 100644 --- a/lib/classes/globalsearch/GlobalSearchFiles.php +++ b/lib/classes/globalsearch/GlobalSearchFiles.php @@ -191,7 +191,7 @@ class GlobalSearchFiles extends GlobalSearchModule implements GlobalSearchFullte return Folder::find($fileref->folder_id)->getTypedFolder(); }); - if (!$folder->isFileDownloadable($fileref, $GLOBALS['user']->id)) { + if (!($folder->isVisible($GLOBALS['user']->id) && $folder->isReadable($GLOBALS['user']->id))) { return null; }