MDL-40191 folder: Do not check capability in renderer
authorMarina Glancy <marina@moodle.com>
Wed, 4 Dec 2013 07:27:55 +0000 (18:27 +1100)
committerMarina Glancy <marina@moodle.com>
Wed, 4 Dec 2013 07:27:55 +0000 (18:27 +1100)
Capability to access the module is already checked before calling the renderer. Extra check works bad together with switching roles

mod/folder/renderer.php

index 07c0f63..c0faeb1 100644 (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;
         }