mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-40191 folder: Do not check capability in renderer
Capability to access the module is already checked before calling the renderer. Extra check works bad together with switching roles
This commit is contained in:
parent
03579d47ca
commit
b9c3f07ad0
@ -40,11 +40,10 @@ class mod_folder_renderer extends plugin_renderer_base {
|
||||
$folderinstances = get_fast_modinfo($folder->course)->get_instances_of('folder');
|
||||
if (!isset($folderinstances[$folder->id]) ||
|
||||
!($cm = $folderinstances[$folder->id]) ||
|
||||
!$cm->uservisible ||
|
||||
!($context = context_module::instance($cm->id)) ||
|
||||
!has_capability('mod/folder:view', $context)) {
|
||||
// some error in parameters or module is not visible to the user
|
||||
// don't throw any errors in renderer, just return empty string
|
||||
!($context = context_module::instance($cm->id))) {
|
||||
// Some error in parameters.
|
||||
// Don't throw any errors in renderer, just return empty string.
|
||||
// Capability to view module must be checked before calling renderer.
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user