Skip to content

Commit

Permalink
Merge pull request #383 from nstefanski/security-settings-error2
Browse files Browse the repository at this point in the history
error handling for security settings
  • Loading branch information
jrchamp authored May 19, 2022
2 parents fe892ad + a108fb4 commit 4256ebc
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions classes/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,29 @@ public function get_user_settings($userid) {
*/
public function get_account_meeting_security_settings() {
$url = 'accounts/me/settings?option=meeting_security';
$response = null;
try {
$response = $this->make_call($url);
// Set a default meeting password requirment if it is not present.
if (!isset($response->meeting_security->meeting_password_requirement)) {
$response->meeting_security->meeting_password_requirement = (object) DEFAULT_MEETING_PASSWORD_REQUIREMENT;
}
$meetingsecurity = $response->meeting_security;
} catch (moodle_exception $error) {
throw $error;
// Only available for Paid account, return default settings.
$meetingsecurity = new stdClass();
// If some other error, show debug message.
if ($error->zoomerrorcode != 200) {
debugging($error->getMessage());
}
}
return $response->meeting_security;

// Set a default meeting password requirment if it is not present.
if (!isset($meetingsecurity->meeting_password_requirement)) {
$meetingsecurity->meeting_password_requirement = (object) self::DEFAULT_MEETING_PASSWORD_REQUIREMENT;
}

// Set a default encryption setting if it is not present.
if (!isset($meetingsecurity->end_to_end_encrypted_meetings)) {
$meetingsecurity->end_to_end_encrypted_meetings = false;
}

return $meetingsecurity;
}

/**
Expand Down

0 comments on commit 4256ebc

Please sign in to comment.