Sort get_user_roles from most local to most general

This commit is contained in:
moodler 2006-09-17 03:33:22 +00:00
parent 08abf1dc0e
commit ec6eb11097

View file

@ -2255,11 +2255,13 @@ function get_user_roles($context, $userid=0, $checkparentcontexts=true) {
return get_records_sql('SELECT ra.*, r.name return get_records_sql('SELECT ra.*, r.name
FROM '.$CFG->prefix.'role_assignments ra, FROM '.$CFG->prefix.'role_assignments ra,
'.$CFG->prefix.'role r '.$CFG->prefix.'role r,
'.$CFG->prefix.'context c
WHERE ra.userid = '.$userid. WHERE ra.userid = '.$userid.
' AND ra.roleid = r.id ' AND ra.roleid = r.id
AND ra.contextid = c.id
AND '.$contexts. AND '.$contexts.
' ORDER BY r.sortorder ASC'); ' ORDER BY c.aggregatelevel DESC');
} }
/** /**