MDL-28670 webservice : (review) changes improving performance

This commit is contained in:
Aparup Banerjee 2011-11-14 11:25:36 +08:00
parent e88c193fb0
commit 8887601196
2 changed files with 8 additions and 5 deletions

View File

@ -67,9 +67,11 @@ if ( !is_siteadmin($USER->id)
$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 File

@ -320,10 +320,11 @@ class core_webservice_renderer extends plugin_renderer_base {
$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',