From ff297eca792ee0d178ba602d8ddcb5072f271e7f Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Wed, 24 Feb 2010 09:03:11 +0000 Subject: [PATCH] moodlelib: sync_metacourse MDL-20626 wasn't respecting hidden role assignments This causes hidden role assignments to become public on metacourses Many thanks to Daniel Neis for the patch forward ported from MOODLE_19_STABLE Signed-off-by: Dan Poltawski --- lib/moodlelib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 8e5968aca17..17e603c4264 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2957,7 +2957,7 @@ function sync_metacourse($course) { // Get assignments of a user to a role that exist in a child course, but // not in the meta coure. That is, get a list of the assignments that need to be made. if (!$assignments = $DB->get_records_sql(" - SELECT ra.id, ra.roleid, ra.userid + SELECT ra.id, ra.roleid, ra.userid, ra.hidden FROM {role_assignments} ra, {context} con, {course_meta} cm WHERE ra.contextid = con.id AND con.contextlevel = ".CONTEXT_COURSE." AND @@ -3005,7 +3005,7 @@ function sync_metacourse($course) { // Make the assignments. foreach ($assignments as $assignment) { - $success = role_assign($assignment->roleid, $assignment->userid, 0, $context->id) && $success; + $success = role_assign($assignment->roleid, $assignment->userid, 0, $context->id, 0, 0, $assignment->hidden) && $success; } return $success;