Open leonstr opened 5 months ago
lib.php
explicitly only checks the seat limit if the user doesn't already exist:
188 $user = utils::get_user($client, $username);
189 if (!$user) {
190 // If user doesn't exist create, only when seats are higher then participant count.
191 $tier = new tier($sub->get('tierid'));
192 if ( $sub->get_participant_count() >= (int) $tier->get('seats') ) {
193 $errorurl = $CFG->wwwroot . '/mod/scormremote/error.php?error=sublimitreached';
194 header('Content-Type: text/javascript');
195 exit($OUTPUT->render_from_template('mod_scormremote/init', ['datasource' => $errorurl]));
196 }
197 $user = utils::create_user($client->get('primarydomain'), $client, $username, $fullname);
198 }
But surely seats used > seat limit isn't the intended behaviour?
Proposed fix in PR #66.
If a user has already been created for one tier they can access other tiers even if the seat limit has been reached.
Steps to reproduce issue
mod/scormremote/clients.php
) with course subscriptions to Scormremote1 and Scormremote2.Expected results
Error 402 | Subscription limit reached because there is only one seat for tier Scormremote2 and that is in use by student2.
Actual results
The SCORM is displayed. The Moodle site admin sees ( 2 / 1) for the seats in use for tier Scormremote2 under Manage clients (
mod/scormremote/clients.php
)