MDL-40353 fixed wrong redirection on course group page
authorMarina Glancy <marina@moodle.com>
Thu, 27 Jun 2013 03:45:16 +0000 (13:45 +1000)
committerMarina Glancy <marina@moodle.com>
Thu, 27 Jun 2013 03:54:43 +0000 (13:54 +1000)
group/index.php

index 1f7aabd..d3f751c 100644 (file)
@@ -56,14 +56,12 @@ $PAGE->set_url($url);
 // Make sure that the user has permissions to manage groups.
 require_login($course);
 
 // Make sure that the user has permissions to manage groups.
 require_login($course);
 
+$context = get_context_instance(CONTEXT_COURSE, $course->id);
+require_capability('moodle/course:managegroups', $context);
+
 $PAGE->requires->yui2_lib('connection');
 $PAGE->requires->js('/group/clientlib.js');
 
 $PAGE->requires->yui2_lib('connection');
 $PAGE->requires->js('/group/clientlib.js');
 
-$context = get_context_instance(CONTEXT_COURSE, $course->id);
-if (!has_capability('moodle/course:managegroups', $context)) {
-    redirect('/course/view.php', array('id'=>$course->id)); // Not allowed to manage all groups
-}
-
 // Check for multiple/no group errors
 if (!$singlegroup) {
     switch($action) {
 // Check for multiple/no group errors
 if (!$singlegroup) {
     switch($action) {