-
Bug
-
Resolution: Fixed
-
Minor
-
2.3.8
-
None
-
2013051901
-
MOODLE_23_STABLE
-
MOODLE_25_STABLE
The following line was added to /mod/questionnaire/report.php at some point between 2.3.3 (Build: 20121112) and 2.3.8 (Build: 20130708):
— a/mod/questionnaire/report.php Wed Jan 09 09:46:38 2013
+++ b/mod/questionnaire/report.php Wed Aug 14 18:08:38 2013
@@ -579,6 +578,7 @@
case 'vall': // view all responses
case 'vallasort': // view all responses sorted in ascending order
case 'vallarsort': // view all responses sorted in descending order
+ require_capability('mod/questionnaire:readallresponseanytime', $context);
$PAGE->set_title(get_string('questionnairereport', 'questionnaire'));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->navbar->add(get_string('questionnairereport', 'questionnaire'));
This capability requirement overrides everything that came before it, so the ability to view all responses is now based entirely on mod/questionnaire:readallresponseanytime. All previous checks of mod/questionnaire:readallresponses and $questionnaire->resp_view in both tabs.php and report.php are irrelevant.
If mod/questionnaire:readallresponseanytime is allowed, students can always see all responses, even if the $questionnaire->resp_view conditions are not met. This is confusing in itself, but I assume it's by design.
If mod/questionnaire:readallresponseanytime is not allowed, students can never see all responses, even if all other conditions are met. If mod/questionnaire:readallresponses is allowed and the $questionnaire->resp_view conditions are met, the "All responses" tab is displayed, but students see the following error when they click it:
Sorry, but you do not currently have permissions to do that (Read all responses any time)
If this final check is necessary, it should replicate the previous checks more closely so they're not rendered meaningless.