From ec6eb110975b5e62311ae051a14ffa517727f0d0 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 17 Sep 2006 03:33:22 +0000 Subject: [PATCH] Sort get_user_roles from most local to most general --- lib/accesslib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 8ab5e6e244..e93fde2211 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2255,11 +2255,13 @@ function get_user_roles($context, $userid=0, $checkparentcontexts=true) { return get_records_sql('SELECT ra.*, r.name FROM '.$CFG->prefix.'role_assignments ra, - '.$CFG->prefix.'role r + '.$CFG->prefix.'role r, + '.$CFG->prefix.'context c WHERE ra.userid = '.$userid. ' AND ra.roleid = r.id + AND ra.contextid = c.id AND '.$contexts. - ' ORDER BY r.sortorder ASC'); + ' ORDER BY c.aggregatelevel DESC'); } /** -- 2.39.5