mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 23:59:41 +02:00
Merge branch 'MDL-83959' of https://github.com/paulholden/moodle
This commit is contained in:
commit
a846c4a58f
3 changed files with 12 additions and 9 deletions
|
@ -91,10 +91,9 @@ class service extends base {
|
||||||
))
|
))
|
||||||
->add_joins($this->get_joins())
|
->add_joins($this->get_joins())
|
||||||
->set_type(column::TYPE_TEXT)
|
->set_type(column::TYPE_TEXT)
|
||||||
->add_field("{$tokenalias}.name")
|
->add_fields("{$tokenalias}.name, {$tokenalias}.shortname")
|
||||||
->add_field("{$tokenalias}.shortname")
|
|
||||||
->set_is_sortable(true)
|
->set_is_sortable(true)
|
||||||
->add_callback(static function(string $value, \stdClass $row): string {
|
->add_callback(static function(?string $value, \stdClass $row): string {
|
||||||
$output = $value;
|
$output = $value;
|
||||||
$output .= \html_writer::tag('div', format_text($row->shortname), [
|
$output .= \html_writer::tag('div', format_text($row->shortname), [
|
||||||
'class' => 'small text-muted',
|
'class' => 'small text-muted',
|
||||||
|
|
|
@ -141,9 +141,10 @@ class tokens extends system_report {
|
||||||
"{$entityservicealias}.id",
|
"{$entityservicealias}.id",
|
||||||
"{$entityservicealias}.shortname",
|
"{$entityservicealias}.shortname",
|
||||||
]))
|
]))
|
||||||
->add_callback(static function(string $value, \stdClass $row): string {
|
->add_callback(static function($value, \stdClass $row): string {
|
||||||
global $OUTPUT;
|
global $OUTPUT;
|
||||||
$missingcapabilities = self::get_missing_capabilities((int)$row->userid, (int)$row->id, $row->shortname);
|
|
||||||
|
$missingcapabilities = self::get_missing_capabilities((int) $row->userid, (int) $row->id, (string) $row->shortname);
|
||||||
if (empty($missingcapabilities)) {
|
if (empty($missingcapabilities)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,11 +454,14 @@ class webservice {
|
||||||
*/
|
*/
|
||||||
public function get_token_by_id_with_details($tokenid) {
|
public function get_token_by_id_with_details($tokenid) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
$sql = "SELECT t.id, t.token, u.id AS userid, u.firstname, u.lastname, s.name, t.creatorid
|
$sql = "SELECT t.id, t.token, u.id AS userid, u.firstname, u.lastname, s.name, t.creatorid
|
||||||
FROM {external_tokens} t, {user} u, {external_services} s
|
FROM {external_tokens} t
|
||||||
WHERE t.id=? AND t.tokentype = ? AND s.id = t.externalserviceid AND t.userid = u.id";
|
LEFT JOIN {user} u ON u.id = t.userid
|
||||||
$token = $DB->get_record_sql($sql, array($tokenid, EXTERNAL_TOKEN_PERMANENT), MUST_EXIST);
|
LEFT JOIN {external_services} s ON s.id = t.externalserviceid
|
||||||
return $token;
|
WHERE t.id = ? AND t.tokentype = ?";
|
||||||
|
|
||||||
|
return $DB->get_record_sql($sql, [$tokenid, EXTERNAL_TOKEN_PERMANENT], MUST_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue