Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement registration validation (Version 2) #622

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 16 additions & 0 deletions classes/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ private function database_to_api($zoom, $cmid) {

if (isset($zoom->registration)) {
$data['settings']['approval_type'] = $zoom->registration;
if ($zoom->registration != ZOOM_REGISTRATION_OFF) {
$data['settings']['use_pmi'] = false;
}
}

if (!empty($zoom->webinar)) {
Expand Down Expand Up @@ -1301,4 +1304,17 @@ public function get_recording_settings($meetinguuid) {
$response = $this->make_call($url);
return $response;
}

/**
* Returns whether or not the current user is permitted to create a meeting/webinar that requires registration.
* @return boolean
*/
public function is_user_permitted_to_require_registration() {
global $USER;
$zoomuser = zoom_get_user(zoom_get_api_identifier($USER));
if ($zoomuser && $zoomuser->type == ZOOM_USER_TYPE_PRO) {
return true;
}
return false;
}
}
1 change: 1 addition & 0 deletions lang/en/zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
$string['err_long_timeframe'] = 'Requested time frame too long, showing results of latest month in range.';
$string['err_password'] = 'Passcode may only contain the following characters: [a-z A-Z 0-9 @ - _ *]. Max of 10 characters.';
$string['err_password_required'] = 'Passcode is required.';
$string['err_registration'] = 'The current user is not capable of creating a meeting/webinar that requires registration.';
jrchamp marked this conversation as resolved.
Show resolved Hide resolved
$string['err_repeat_monthly_interval'] = 'Max interval for monthly meeting is 3 months';
$string['err_repeat_weekly_interval'] = 'Max interval for weekly meeting is 12 weeks';
$string['err_start_time_past'] = 'The start date cannot be in the past.';
Expand Down
9 changes: 9 additions & 0 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,15 @@ public function validation($data, $files) {
}
}

// Validation for registration required functionality.
if ($data['registration'] != ZOOM_REGISTRATION_OFF) {
// Recurring meeting validation already handled by hiding registration option where required.
// Check licensing of the user.
if (!zoom_webservice()->is_user_permitted_to_require_registration()) {
$errors['registration'] = get_string('err_registration', 'mod_zoom');
}
}

return $errors;
}
}