Commit fbf6cfe6 authored by Jerome Mouneyrac's avatar Jerome Mouneyrac
Browse files

MDL-30225 Creating new web service tokens create error

parent 668a499d
...@@ -515,9 +515,9 @@ class webservice { ...@@ -515,9 +515,9 @@ class webservice {
public function get_user_capabilities($userid) { public function get_user_capabilities($userid) {
global $DB; global $DB;
//retrieve the user capabilities //retrieve the user capabilities
$sql = "SELECT rc.id, rc.capability FROM {role_capabilities} rc, {role_assignments} ra $sql = "SELECT DISTINCT rc.id, rc.capability FROM {role_capabilities} rc, {role_assignments} ra
WHERE rc.roleid=ra.roleid AND ra.userid= ?"; WHERE rc.roleid=ra.roleid AND ra.userid= ? AND rc.permission = ?";
$dbusercaps = $DB->get_records_sql($sql, array($userid)); $dbusercaps = $DB->get_records_sql($sql, array($userid, CAP_ALLOW));
$usercaps = array(); $usercaps = array();
foreach ($dbusercaps as $usercap) { foreach ($dbusercaps as $usercap) {
$usercaps[$usercap->capability] = true; $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