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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

paulandm
Copy link
Contributor

@paulandm paulandm commented Oct 1, 2024

Check to see if current user is capable of creating meetings with the registration option enabled.
It seems like only users with a 'Pro' license are capable of creating such meetings.

Check to see if current user is capable of creating meetings with the registration option
Set 'use_pmi' to false when registration is requested.
@paulandm paulandm changed the title Implement registration validation Implement registration validation (Version 2) Oct 2, 2024
@smbader smbader requested a review from jrchamp October 3, 2024 15:34
@jrchamp jrchamp added the bug Fixes problems or reduces technical debt label Oct 10, 2024
Copy link
Collaborator

@jrchamp jrchamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @paulandm,

This looks really good! I have a few suggestions that may help. If you have any questions, please let us know.

*/
public function get_user_registration_capable() {
global $USER;
$zoomuser = $this->get_user($USER->email);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lookup users based on the configured field, so there's a different code pattern for getting the person. Also, there is a function that caches the results, so we can avoid unnecessary API calls.

Suggested change
$zoomuser = $this->get_user($USER->email);
$zoomuser = zoom_get_user(zoom_get_api_identifier($USER));

mod_form.php Outdated
// Check licensing of the user.
$registrationcapableuserfound = zoom_webservice()->get_user_registration_capable();
if (!$registrationcapableuserfound) {
$errors['registration'] = get_string('err_registration', 'zoom');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the full frankenstyle name, not the activity module shortname.

Suggested change
$errors['registration'] = get_string('err_registration', 'zoom');
$errors['registration'] = get_string('err_registration', 'mod_zoom');

mod_form.php Outdated
Comment on lines 1179 to 1180
$registrationcapableuserfound = zoom_webservice()->get_user_registration_capable();
if (!$registrationcapableuserfound) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel weird about the use of the English word "capable", because it implies "fitness". Translation to other languages may also be negatively affected. "allowed" or "permitted" seem more appropriate to me, because they imply "licensed", "granted", "has the permission".

Implemented PR feedback/suggestions.
@paulandm
Copy link
Contributor Author

Hi @jrchamp

Thanks for your feedback. I've implemented the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes problems or reduces technical debt
Projects
Status: Testing needed
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants