From 6c384dd1bbcf25ebd61b47db0f93b789e470e81f Mon Sep 17 00:00:00 2001 From: vyshane Date: Tue, 15 Aug 2006 09:56:41 +0000 Subject: [PATCH] Replaced isteacher and isadmin calls by has_capability --- course/import/groups/index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/course/import/groups/index.php b/course/import/groups/index.php index bb68f6d8e0..907e8d2ceb 100755 --- a/course/import/groups/index.php +++ b/course/import/groups/index.php @@ -12,9 +12,11 @@ } 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()) { @@ -159,9 +161,10 @@ $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')); } -- 2.39.5