Skip to content
Browse files

MDL-30225 Creating new web service tokens create error

  • Loading branch information...
1 parent 35eb31f commit adca1840c4eb445bdbd67e0cbf09852b3ac507c5 @mouneyrac mouneyrac committed with danpoltawski
Showing with 3 additions and 3 deletions.
  1. +3 −3 webservice/lib.php
View
6 webservice/lib.php
@@ -477,9 +477,9 @@ public function get_service_required_capabilities($serviceid) {
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;

0 comments on commit adca184

Please sign in to comment.
Something went wrong with that request. Please try again.