Skip to content
Browse files

MDL-28670 webservice : (review) changes improving performance

  • Loading branch information...
1 parent cc9a416 commit bf8ab84950d3febba825fedc7bbebba8bab55766 @nebgor nebgor committed
Showing with 8 additions and 5 deletions.
  1. +5 −3 user/managetoken.php
  2. +3 −2 webservice/renderer.php
View
8 user/managetoken.php
@@ -67,9 +67,11 @@
$webservice->generate_user_ws_tokens($USER->id); //generate all token that need to be generated
$tokens = $webservice->get_user_ws_tokens($USER->id);
foreach ($tokens as $token) {
- $authlist = $webservice->get_ws_authorised_user($token->wsid, $USER->id);
- if(empty($authlist) && $token->restrictedusers) {
- $token->enabled = false;
+ if ($token->restrictedusers) {
+ $authlist = $webservice->get_ws_authorised_user($token->wsid, $USER->id);
+ if (empty($authlist)) {
+ $token->enabled = false;
+ }
}
}
$webservicetokenboxhtml = $wsrenderer->user_webservice_tokens_box($tokens, $USER->id,
View
5 webservice/renderer.php
@@ -320,10 +320,11 @@ public function user_webservice_tokens_box($tokens, $userid, $documentation = fa
$validuntil = date("F j, Y"); //TODO: language support (look for moodle function)
}
+ $tokenname = $token->name;
if (!$token->enabled) { //that is the (1 token-1ws) related ws is not enabled.
- $token->name = '<span class="dimmed_text">'.$token->name.'</span>';
+ $tokenname = '<span class="dimmed_text">'.$token->name.'</span>';
}
- $row = array($token->token, $token->name, $validuntil, $creatoratag, $reset);
+ $row = array($token->token, $tokenname, $validuntil, $creatoratag, $reset);
if ($documentation) {
$doclink = new moodle_url('/webservice/wsdoc.php',

0 comments on commit bf8ab84

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