Skip to content
Snippets Groups Projects
Commit 1e4f9fc7 authored by André Noack's avatar André Noack Committed by André Noack
Browse files

check folder visibility

parent b7ba92a0
No related branches found
No related tags found
No related merge requests found
...@@ -387,10 +387,12 @@ class FilesController extends AuthenticatedController ...@@ -387,10 +387,12 @@ class FilesController extends AuthenticatedController
$this->all_files = []; $this->all_files = [];
$count_visible = 0; $count_visible = 0;
foreach ($all_file_refs as $file_ref) { foreach ($all_file_refs as $file_ref) {
$vue_data = FilesystemVueDataManager::getFileVueData( if ($file_ref->getFileType()->isVisible($GLOBALS['user']->id)) {
$file_ref->getFileType(), $vue_data = FilesystemVueDataManager::getFileVueData(
$this->topFolder $file_ref->getFileType(),
); $this->topFolder
);
}
if (isset($vue_data['download_url'])) { if (isset($vue_data['download_url'])) {
$this->all_files[] = $vue_data; $this->all_files[] = $vue_data;
if (++$count_visible === 5) break; if (++$count_visible === 5) break;
...@@ -471,7 +473,6 @@ class FilesController extends AuthenticatedController ...@@ -471,7 +473,6 @@ class FilesController extends AuthenticatedController
//] //]
$folders = []; $folders = [];
$new_file_refs = FileRef::findAll($GLOBALS['user']->id, $this->begin, $this->end, $this->course_id, $this->page_size, $offset); $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: //Group the file refs by their folder:
foreach ($new_file_refs as $file_ref) { foreach ($new_file_refs as $file_ref) {
if (!is_array($folders[$file_ref->folder_id])) { if (!is_array($folders[$file_ref->folder_id])) {
......
...@@ -191,7 +191,7 @@ class GlobalSearchFiles extends GlobalSearchModule implements GlobalSearchFullte ...@@ -191,7 +191,7 @@ class GlobalSearchFiles extends GlobalSearchModule implements GlobalSearchFullte
return Folder::find($fileref->folder_id)->getTypedFolder(); 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; return null;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment