fixing wrong capability check

This commit is contained in:
toyomoyo
2007-02-27 05:46:57 +00:00
parent 9f39ff6d96
commit ab1736ab1f
+2 -2
View File
@@ -158,13 +158,13 @@
//if courseid is set
if (isset($newgroup->courseid)){
$newgroup->timecreated = time();
$newgroup->timecreated = time();
$linenum++;
$groupname = $newgroup->name;
$newgrpcoursecontext = get_context_instance(CONTEXT_COURSE, $newgroup->courseid);
///Users cannot upload groups in courses they cannot update.
if (!has_capability('moodle/course:update', $newgrpcoursecontext)){
if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){
notify("$newgroup->name ".get_string('notaddedto').$newgroup->coursename.get_string('notinyourcapacity'));
} else {
if (get_record("groups","name",$groupname,"courseid",$newgroup->courseid) || !($newgroup->id = insert_record("groups", $newgroup))) {