mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-71017 oath2: configuration check fix and return types
This commit is contained in:
parent
5a6f05c605
commit
57a444d31f
4 changed files with 10 additions and 9 deletions
|
@ -102,7 +102,7 @@ class renderer extends plugin_renderer_base {
|
|||
// Internal services issuer.
|
||||
if ((int)$issuer->get('showonloginpage') == issuer::LOGINONLY) {
|
||||
$serviceissuer = $this->pix_icon('no', get_string('issuersservicesnotallow', 'tool_oauth2'), 'tool_oauth2');
|
||||
} else if ($issuer->get('id') && $issuer->is_configured() && !empty($issuer->get_endpoint_url('userinfo'))) {
|
||||
} else if ($issuer->get('id') && $issuer->is_configured()) {
|
||||
$serviceissuer = $this->pix_icon('yes', get_string('issuersservicesallow', 'tool_oauth2'), 'tool_oauth2');
|
||||
} else {
|
||||
$serviceissuer = $this->pix_icon('notconfigured', get_string('notconfigured', 'tool_oauth2'), 'tool_oauth2');
|
||||
|
|
|
@ -152,7 +152,7 @@ Feature: Basic OAuth2 functionality
|
|||
When I press "Save changes"
|
||||
Then I should see "Changes saved"
|
||||
And I should see "OpenBadges"
|
||||
And "Not configured" "icon" should exist in the "OpenBadges" "table_row"
|
||||
And "Allow services" "icon" should exist in the "OpenBadges" "table_row"
|
||||
And "Do not allow login" "icon" should exist in the "OpenBadges" "table_row"
|
||||
And "Service discovery successful" "icon" should exist in the "OpenBadges" "table_row"
|
||||
And the "src" attribute of "table.admintable th img" "css_element" should contain "IMS-Global-Logo.png"
|
||||
|
@ -222,8 +222,8 @@ Feature: Basic OAuth2 functionality
|
|||
When I press "Save changes"
|
||||
Then I should see "Could not discover end points for identity issuer: Invalid custom service"
|
||||
And I should see "URL: https://dc.imsglobal.org/.well-known/openid-configuration"
|
||||
And "Allow services" "icon" should exist in the "Invalid custom service" "table_row"
|
||||
And "Do not allow login" "icon" should exist in the "Invalid custom service" "table_row"
|
||||
And "Not configured" "icon" should exist in the "Invalid custom service" "table_row"
|
||||
And I should see "-" in the "Invalid custom service" "table_row"
|
||||
And I click on "Configure endpoints" "link" in the "Invalid custom service" "table_row"
|
||||
And I should not see "discovery_endpoint"
|
||||
|
@ -263,8 +263,8 @@ Feature: Basic OAuth2 functionality
|
|||
When I press "Save changes"
|
||||
And I should see "Changes saved"
|
||||
And I should see "Empty custom service"
|
||||
And "Allow services" "icon" should exist in the "Empty custom service" "table_row"
|
||||
And "Do not allow login" "icon" should exist in the "Empty custom service" "table_row"
|
||||
And "Not configured" "icon" should exist in the "Empty custom service" "table_row"
|
||||
And I should see "-" in the "Empty custom service" "table_row"
|
||||
And I click on "Configure endpoints" "link" in the "Empty custom service" "table_row"
|
||||
And I should not see "discovery_endpoint"
|
||||
|
|
|
@ -111,11 +111,12 @@ class api {
|
|||
/**
|
||||
* List all the issuers, ordered by the sortorder field
|
||||
*
|
||||
* @param bool $showall also include issues that are configured to be shown only on login page
|
||||
* @param bool $includeloginonly also include issuers that are configured to be shown only on login page,
|
||||
* By default false, in this case the method returns all issuers that can be used in services
|
||||
* @return \core\oauth2\issuer[]
|
||||
*/
|
||||
public static function get_all_issuers(bool $showall = false) {
|
||||
if ($showall) {
|
||||
public static function get_all_issuers(bool $includeloginonly = false) {
|
||||
if ($includeloginonly) {
|
||||
return issuer::get_records([], 'sortorder');
|
||||
} else {
|
||||
return array_values(issuer::get_records_select('showonloginpage<>?', [issuer::LOGINONLY], 'sortorder'));
|
||||
|
|
|
@ -196,7 +196,7 @@ class issuer extends persistent {
|
|||
* @return bool
|
||||
* @throws \coding_exception
|
||||
*/
|
||||
public function is_available_for_login() {
|
||||
public function is_available_for_login(): bool {
|
||||
return $this->get('id') &&
|
||||
$this->is_configured() &&
|
||||
$this->get('showonloginpage') != self::SERVICEONLY &&
|
||||
|
@ -265,7 +265,7 @@ class issuer extends persistent {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_display_name() {
|
||||
public function get_display_name(): string {
|
||||
return $this->get('loginpagename') ? $this->get('loginpagename') : $this->get('name');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue