]> git.mjollnir.org Git - moodle.git/commitdiff
Sort get_user_roles from most local to most general
authormoodler <moodler>
Sun, 17 Sep 2006 03:33:22 +0000 (03:33 +0000)
committermoodler <moodler>
Sun, 17 Sep 2006 03:33:22 +0000 (03:33 +0000)
lib/accesslib.php

index 8ab5e6e244a70ad0465187d956125b35184a5d32..e93fde2211adfff5f126e4533ba0150b0bcb1f3a 100755 (executable)
@@ -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');
 }
 
 /**