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:
Marina Glancy 2013-12-04 18:27:55 +11:00
parent 03579d47ca
commit b9c3f07ad0

View File

@ -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;
}