MNet user creation failing with timeout

Bug #1990529 reported by Guillaume COLSON
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Unassigned

Bug Description

Mahara version 22.04, Linux, Mysql

The bug resolution in the following commit don't include cases where user is passed to the function create_user() as an instanceof User.
https://github.com/MaharaProject/mahara/commit/e2f7d70f49e2101424255cba8f84b453320ee36d

This is the case with an MNet authentication from moodle.
In this case the function is called from file auth/xmlrpc/lib.php and the object user is created beforehand.
The institution membership notification is fired and the user creation finish after the timeout which is way too long to be seen as a success by the user.

To correct this, you only need to change a line :

--- a/htdocs/lib/user.php
+++ b/htdocs/lib/user.php
@@ -2702,8 +2702,8 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
             $user->expiry = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')) + (int)get_config('defaultaccountlifetime'));
         }
         $user->id = insert_record('usr', $user, 'id', true);
- $user->newuser = true;
     }
+ $user->newuser = true;

     if (isset($user->email) && $user->email != '') {
         set_profile_field($user->id, 'email', $user->email, TRUE);

Thanks in advance for the correction

Changed in mahara:
milestone: none → 22.10.1
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Robert Lyon (robertl-9)
Changed in mahara:
status: Confirmed → In Progress
Changed in mahara:
milestone: 22.10.1 → 22.10.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13234
Committed: https://git.mahara.org/mahara/mahara/commit/b9169fe9f2cb57d21820cabce211f623d599ca79
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit b9169fe9f2cb57d21820cabce211f623d599ca79
Author: Robert Lyon <email address hidden>
Date: Mon Oct 17 10:57:23 2022 +1300

Bug 1990529: set create_user() newuser flag correctly

It should be set regardless if user was created from user object or not

Change-Id: Id65a6349f17824fe10e21dcfa36d5cd77961aa0b
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Doris Tam (doristam)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.