Commit a1618882 authored by Dan Poltawski's avatar Dan Poltawski
Browse files

Merge branch 'MDL-30225' of git://github.com/mouneyrac/moodle

parents bb0bd8cb fbf6cfe6
......@@ -515,9 +515,9 @@ class webservice {
public function get_user_capabilities($userid) {
global $DB;
//retrieve the user capabilities
$sql = "SELECT rc.id, rc.capability FROM {role_capabilities} rc, {role_assignments} ra
WHERE rc.roleid=ra.roleid AND ra.userid= ?";
$dbusercaps = $DB->get_records_sql($sql, array($userid));
$sql = "SELECT DISTINCT rc.id, rc.capability FROM {role_capabilities} rc, {role_assignments} ra
WHERE rc.roleid=ra.roleid AND ra.userid= ? AND rc.permission = ?";
$dbusercaps = $DB->get_records_sql($sql, array($userid, CAP_ALLOW));
$usercaps = array();
foreach ($dbusercaps as $usercap) {
$usercaps[$usercap->capability] = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment