]> git.mjollnir.org Git - moodle.git/commitdiff
Replaced isteacher and isadmin calls by has_capability
authorvyshane <vyshane>
Tue, 15 Aug 2006 09:56:41 +0000 (09:56 +0000)
committervyshane <vyshane>
Tue, 15 Aug 2006 09:56:41 +0000 (09:56 +0000)
course/import/groups/index.php

index bb68f6d8e0ac026dfa9a844cd42a4d47bc9b35e7..907e8d2ceb620177fe290f203c7511dd5f9d17cf 100755 (executable)
     }
        
        require_login($course->id);
+       $context = get_context_instance(CONTEXT_COURSE, $mycourseid);
        
-    if (!isadmin() && !isteacheredit($course->id)) {
-        error("You must be an administrator to edit users this way.");
+       
+    if (!has_capability('moodle/course:managegroups', $context)) {
+        error("You do not have the required permissions to manage groups.");
     }
 
     //if (!confirm_sesskey()) {
                                $newgroup->timecreated = time();
                        $linenum++;
                        $groupname = $newgroup->name;
-                               
-                                       ///Teachers can not upload groups in courses they are not teaching...
-                                       if (!isadmin() and !isteacheredit($newgroup->courseid)){
+                                   $newgrpcoursecontext = get_context_instance(CONTEXT_COURSE, $newgroup->courseid);
+                                   
+                                       ///Users cannot upload groups in courses they cannot update.
+                                       if (has_capability('moodle/course:update', $newgrpcoursecontext)){
                                                notify("$newgroup->name ".get_string('notaddedto').$newgroup->coursename.get_string('notinyourcapacity'));
                                        }