Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-28670_m21' of git://github.com/nebgor/moodle into M…

…OODLE_21_STABLE
  • Loading branch information...
commit fcd27b4981a1b7b49aff086c681d1aa9919a3c9a 2 parents 66e9f5c + bf8ab84
@samhemelryk samhemelryk authored
View
10 user/managetoken.php
@@ -66,7 +66,15 @@
if (empty($resetconfirmation)) {
$webservice->generate_user_ws_tokens($USER->id); //generate all token that need to be generated
$tokens = $webservice->get_user_ws_tokens($USER->id);
- $webservicetokenboxhtml = $wsrenderer->user_webservice_tokens_box($tokens, $USER->id,
+ foreach ($tokens as $token) {
+ 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,
$CFG->enablewsdocumentation); //display the box for web service token
}
}
View
4 webservice/lib.php
@@ -165,7 +165,7 @@ public function generate_user_ws_tokens($userid) {
}
/**
- * Return all ws user token
+ * Return all ws user token with ws enabled/disabled and ws restricted users mode.
* @param integer $userid
* @return array of token
*/
@@ -173,7 +173,7 @@ public function get_user_ws_tokens($userid) {
global $DB;
//here retrieve token list (including linked users firstname/lastname and linked services name)
$sql = "SELECT
- t.id, t.creatorid, t.token, u.firstname, u.lastname, s.name, t.validuntil
+ t.id, t.creatorid, t.token, u.firstname, u.lastname, s.id as wsid, s.name, s.enabled, s.restrictedusers, t.validuntil
FROM
{external_tokens} t, {user} u, {external_services} s
WHERE
View
6 webservice/renderer.php
@@ -320,7 +320,11 @@ public function user_webservice_tokens_box($tokens, $userid, $documentation = fa
$validuntil = date("F j, Y"); //TODO: language support (look for moodle function)
}
- $row = array($token->token, $token->name, $validuntil, $creatoratag, $reset);
+ $tokenname = $token->name;
+ if (!$token->enabled) { //that is the (1 token-1ws) related ws is not enabled.
+ $tokenname = '<span class="dimmed_text">'.$token->name.'</span>';
+ }
+ $row = array($token->token, $tokenname, $validuntil, $creatoratag, $reset);
if ($documentation) {
$doclink = new moodle_url('/webservice/wsdoc.php',

0 comments on commit fcd27b4

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