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

Protect group from license borrowing #630

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

Conversation

izendegi
Copy link

On this PR we

  • Add a new setting to select the Zoom group to protect
  • When recycling licenses, avoid removing license from users belonging to the protected group

settings.php Outdated Show resolved Hide resolved
@smbader smbader added the enhancement Adds new functionality label Dec 5, 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.

This is a nice idea to help avoid unwanted reassignment. A few suggestions to help minimize the negative impacts on users who are not using groups or reassignment.

settings.php Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
classes/webservice.php Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
classes/webservice.php Outdated Show resolved Hide resolved
lang/en/zoom.php Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
@izendegi izendegi force-pushed the ProtectedGroup branch 5 times, most recently from fd5c702 to 5eee4e5 Compare December 20, 2024 14:56
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.

Thank you for all of your timely updates! This is very nice and should help users who needs this functionality. After applying the suggested changes, please make sure that it is still working as expected on your system (as I believe you may be one of the users of this functionality).

classes/webservice.php Outdated Show resolved Hide resolved
classes/webservice.php Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
classes/webservice.php Outdated Show resolved Hide resolved
@izendegi
Copy link
Author

Hi, @jrchamp

We've been using the original code for more than a year but haven't tested these last changes extensively (I'm on a leave for a couple of weeks), so please give me some weeks to test them and refine if needed.

@jrchamp
Copy link
Collaborator

jrchamp commented Jan 9, 2025

Hi @izendegi

The code looks good to us, so we'll wait for your testing to make sure this version is working for your system. Thank you for your efforts on this!

@izendegi
Copy link
Author

Hi, @jrchamp

I've already tested that the last changes work as expected and added a specific error to throw when there is no user to borrow the license from.

Comment on lines 813 to 815
if ($leastrecentlyactivepaiduserid) {
$this->make_call("users/$leastrecentlyactivepaiduserid", ['type' => ZOOM_USER_TYPE_BASIC], 'patch');
} else {
throw new moodle_exception('errornousersfound', 'mod_zoom');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that it is good to check to match sure that we're making an API call with a good value. However, it doesn't look like this moodle_exception is being caught and it looks like that will prevent the meeting host from being able to join their meeting if there are no licenses available. Where I don't love the idea of failing silently, I do worry about preventing them (and only them) from being able to join the meeting.

Copy link
Author

Choose a reason for hiding this comment

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

I added that exception in the first place because when that situation happens (there is no user to borrow the license from) another exception was already thrown when trying to get the PRO license and there isn't any available.

I agree that throwing an exception is not the best thing to do, so instead of that, I've added the control to try to get the PRO license only if there limit is not reached or if it has been removed from another user, does it make sense to you? Maybe adding a message when this happens could be a good thing to do...

@jrchamp jrchamp added this to the v5.3.0 milestone Jan 16, 2025
@izendegi izendegi force-pushed the ProtectedGroup branch 2 times, most recently from a3bcbf6 to e6b13bb Compare January 17, 2025 09:32
@izendegi
Copy link
Author

I've also rebased this branch from upstream (v5.2.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adds new functionality
Projects
Status: No status
Status: Reviewed, changes needed
Development

Successfully merging this pull request may close these issues.

3 participants