mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-61622 auth: Return age verification settings in get_public_config
This commit is contained in:
parent
1f7565c121
commit
8d9dc60b43
@ -149,6 +149,8 @@ class api {
|
||||
'maintenancemessage' => $maintenancemessage,
|
||||
'mobilecssurl' => !empty($CFG->mobilecssurl) ? $CFG->mobilecssurl : '',
|
||||
'tool_mobile_disabledfeatures' => get_config('tool_mobile', 'disabledfeatures'),
|
||||
'country' => clean_param($CFG->country, PARAM_NOTAGS),
|
||||
'agedigitalconsentverification' => \core_auth\digital_consent::is_age_digital_consent_verification_enabled(),
|
||||
);
|
||||
|
||||
$typeoflogin = get_config('tool_mobile', 'typeoflogin');
|
||||
@ -180,6 +182,12 @@ class api {
|
||||
$settings['identityproviders'] = $identityprovidersdata;
|
||||
}
|
||||
|
||||
// If age is verified, return also the admin contact details.
|
||||
if ($settings['agedigitalconsentverification']) {
|
||||
$settings['supportname'] = clean_param($CFG->supportname, PARAM_NOTAGS);
|
||||
$settings['supportemail'] = clean_param($CFG->supportemail, PARAM_EMAIL);
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,13 @@ class external extends external_api {
|
||||
),
|
||||
'Identity providers', VALUE_OPTIONAL
|
||||
),
|
||||
'country' => new external_value(PARAM_NOTAGS, 'Default site country', VALUE_OPTIONAL),
|
||||
'agedigitalconsentverification' => new external_value(PARAM_BOOL, 'Whether age digital consent verification
|
||||
is enabled.', VALUE_OPTIONAL),
|
||||
'supportname' => new external_value(PARAM_NOTAGS, 'Site support contact name
|
||||
(only if age verification is enabled).', VALUE_OPTIONAL),
|
||||
'supportemail' => new external_value(PARAM_EMAIL, 'Site support contact email
|
||||
(only if age verification is enabled).', VALUE_OPTIONAL),
|
||||
'warnings' => new external_warnings(),
|
||||
)
|
||||
);
|
||||
|
@ -86,6 +86,8 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
'mobilecssurl' => '',
|
||||
'tool_mobile_disabledfeatures' => '',
|
||||
'launchurl' => "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php",
|
||||
'country' => $CFG->country,
|
||||
'agedigitalconsentverification' => \core_auth\digital_consent::is_age_digital_consent_verification_enabled(),
|
||||
'warnings' => array()
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
@ -98,12 +100,16 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
set_config('logo', 'mock.png', 'core_admin');
|
||||
set_config('logocompact', 'mock.png', 'core_admin');
|
||||
set_config('forgottenpasswordurl', 'mailto:fake@email.zy'); // Test old hack.
|
||||
set_config('agedigitalconsentverification', 1);
|
||||
|
||||
list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id);
|
||||
$expected['registerauth'] = 'email';
|
||||
$expected['authinstructions'] = $authinstructions;
|
||||
$expected['typeoflogin'] = api::LOGIN_VIA_BROWSER;
|
||||
$expected['forgottenpasswordurl'] = ''; // Expect empty when it's not an URL.
|
||||
$expected['agedigitalconsentverification'] = true;
|
||||
$expected['supportname'] = $CFG->supportname;
|
||||
$expected['supportemail'] = $CFG->supportemail;
|
||||
|
||||
if ($logourl = $OUTPUT->get_logo_url()) {
|
||||
$expected['logourl'] = $logourl->out(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user