Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions local/o365/classes/task/notifysecretexpiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@ public function get_name(): string {
*/
public function execute(): bool {
if (!utils::is_configured()) {
// Microsoft 365 integration has not been set up; nothing to do.
mtrace('Microsoft 365 integration is not configured. Skipping.');
// The site is not configured with a Microsoft IdP; nothing to do.
mtrace('The site is not configured with a Microsoft identity provider. Skipping.');
return true;
}

if (get_config('auth_oidc', 'clientauthmethod') != AUTH_OIDC_AUTH_METHOD_SECRET) {
// Only the client secret authentication method has a secret that can expire.
mtrace('The client authentication method is not client secret. Skipping.');
return true;
}

if (utils::is_connected() !== true) {
throw new moodle_exception('error_not_connected', 'local_o365');
// The Microsoft 365 integration is not set up, so the secret cannot be checked.
mtrace('The Microsoft 365 integration is not connected. Skipping.');
return true;
}

try {
Expand All @@ -77,12 +85,6 @@ public function execute(): bool {
throw new moodle_exception('errorcannotgetapiclient', 'local_o365');
}

$authenticationmethod = get_config('auth_oidc', 'clientauthmethod');
if ($authenticationmethod != AUTH_OIDC_AUTH_METHOD_SECRET) {
// Currently only support client secret authentication method.
throw new moodle_exception('errorunsupportedsecretauthenticationmethod', 'local_o365');
}

// Resolve and DNS-check the configured notification recipients up front, so that a
// misconfigured recipient is reported through the task status (see the check before the
// final return) even when no notification is due on this run.
Expand Down
1 change: 0 additions & 1 deletion local/o365/lang/en/local_o365.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,6 @@
$string['errorfailedtogetsecrets'] = 'Failed to get secrets.';
$string['errorfailedtosendnotification'] = 'Failed to send notification email to one or more recipients.';
$string['errorsecretexpiryrecipientundeliverable'] = 'One or more configured secret expiry notification recipients cannot receive email (invalid address, or a domain with no MX/A record): {$a}. Update the notification recipients in the OpenID Connect settings.';
$string['errorunsupportedsecretauthenticationmethod'] = 'This task only supports the client secret authentication method.';

// Privacy API.
$string['privacy:metadata:local_o365'] = 'Microsoft 365 Local Plugin';
Expand Down
Loading