Skip to content

Commit

Permalink
MDL-28574 webservices: Explain tokens you can edit but can't see
Browse files Browse the repository at this point in the history
  • Loading branch information
xow committed Jul 31, 2017
1 parent 11df55c commit 72e688d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lang/en/webservice.php
Expand Up @@ -131,6 +131,7 @@
$string['notoken'] = 'The token list is empty.';
$string['onesystemcontrolling'] = 'Allow an external system to control Moodle';
$string['onesystemcontrollingdescription'] = 'The following steps help you to set up the Moodle web services to allow an external system to interact with Moodle. This includes setting up a token (security key) authentication method.';
$string['onlyseecreatedtokens'] = 'Only tokens you own or created can be seen. You can still delete other tokens.';
$string['operation'] = 'Operation';
$string['optional'] = 'Optional';
$string['passwordisexpired'] = 'Password is expired.';
Expand Down
4 changes: 4 additions & 0 deletions lib/adminlib.php
Expand Up @@ -9531,6 +9531,10 @@ public function output_html($data, $query='') {

$return = $OUTPUT->box_start('generalbox webservicestokenui');

if (has_capability('moodle/webservice:managealltokens', context_system::instance())) {
$return .= \html_writer::div(get_string('onlyseecreatedtokens', 'webservice'));
}

$table = new \webservice\token_table('webservicetokens');
$table->define_baseurl($baseurl);
$table->attributes['class'] = 'admintable generaltable'; // Any need changing?
Expand Down
2 changes: 1 addition & 1 deletion webservice/classes/token_table.php
Expand Up @@ -159,7 +159,7 @@ public function col_token($data) {
global $USER;
// Hide the token if it wasn't created by the current user.
if ($data->creatorid != $USER->id) {
return '';
return '-';
}

return $data->token;
Expand Down

0 comments on commit 72e688d

Please sign in to comment.