From 741ea63a70100d57982fc3ff6e510536d93d8a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 22 Apr 2020 17:55:27 +0200 Subject: [PATCH] MDL-67748 admin: Improve the display of tokens the user cannot see --- admin/webservice/tokens.php | 4 ---- lang/en/webservice.php | 2 +- webservice/classes/token_table.php | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/admin/webservice/tokens.php b/admin/webservice/tokens.php index fb95eb4e77b..113dcee5c9e 100644 --- a/admin/webservice/tokens.php +++ b/admin/webservice/tokens.php @@ -115,10 +115,6 @@ if ($action === 'delete') { echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('managetokens', 'core_webservice')); -if (has_capability('moodle/webservice:managealltokens', context_system::instance())) { - echo html_writer::div(get_string('onlyseecreatedtokens', 'core_webservice'), 'alert alert-info'); -} - $table = new \core_webservice\token_table('webservicetokens'); $table->define_baseurl($PAGE->url); $table->attributes['class'] = 'admintable generaltable'; diff --git a/lang/en/webservice.php b/lang/en/webservice.php index cdf7d0a87ab..bd996c9484c 100644 --- a/lang/en/webservice.php +++ b/lang/en/webservice.php @@ -130,7 +130,7 @@ $string['norequiredcapability'] = 'No required capability'; $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'] = 'Any token can be deleted, though you can only view tokens that you created.'; +$string['onlyseecreatedtokens'] = 'You can only view tokens that you created.'; $string['operation'] = 'Operation'; $string['optional'] = 'Optional'; $string['passwordisexpired'] = 'Password is expired.'; diff --git a/webservice/classes/token_table.php b/webservice/classes/token_table.php index 3f12802e4d9..b8730a73b19 100644 --- a/webservice/classes/token_table.php +++ b/webservice/classes/token_table.php @@ -165,7 +165,7 @@ class token_table extends \table_sql { global $USER; // Hide the token if it wasn't created by the current user. if ($data->creatorid != $USER->id) { - return '-'; + return \html_writer::tag('small', get_string('onlyseecreatedtokens', 'core_webservice'), ['class' => 'text-muted']); } return $data->token;