Problem with MNet usernames greater than 30 characters, when $CFG->usersuniquebyusername is used

Bug #1556692 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned
1.10
Fix Released
Medium
Unassigned
15.04
Fix Released
Medium
Unassigned
15.10
Fix Released
Medium
Unassigned

Bug Description

This bug occurs when the following set of circumstances are in use:

1. MNet is set up, with users coming *into* Mahara
2. Mnet is set to auto-create user accounts in Mahara
3. $cfg->usersuniquebyusername is set to "True", which means that users are logged in by matching them against usr.username rather than auth_remote_user.remoteusername

In this case, users coming from Mnet are provisioned in Mahara with a unique username based on their Moodle username, but truncated to 30 characters. Then on subsequent login attempts, their truncated Mahara username doesn't match their Moodle username, and they do not log in correctly.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6132

Revision history for this message
Aaron Wells (u-aaronw) wrote :

This is the second bug we've had in the past year that was caused by get_new_username() truncating usernames to 30 characters. (The earlier one was Bug 1486699, which added the param to change the default new username length, and set it to 40 for SAML.)

I wonder if it would make more sense to just update get_new_username() so that it instead truncates usernames to 255 characters, that being the length of usr.username and auth_remote_user.username.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6132
Committed: https://git.mahara.org/mahara/mahara/commit/b5df2226b4785193889bb71ae60d15054f9ceaf3
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b5df2226b4785193889bb71ae60d15054f9ceaf3
Author: Robert Lyon <email address hidden>
Date: Thu Mar 3 16:02:14 2016 +1300

Fix bug in xmlrpc + $cfg->usersuniquebyusername

Bug 1556692: When used together, these can cause problems when
the ID field from Moodle gets truncated to the default
get_new_username() length of "30", when being inserted into
usr.username in Mahara.

behatnotneeded: Can't test Mnet in Behat

Change-Id: Icdeb78b5298e7d63a0610987b0d8fad34e58d036

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6135

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6136

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/6137

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6137
Committed: https://git.mahara.org/mahara/mahara/commit/d22c3042cbd50cd1bc79c404e60a1e37e1275e61
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit d22c3042cbd50cd1bc79c404e60a1e37e1275e61
Author: Robert Lyon <email address hidden>
Date: Thu Mar 3 16:02:14 2016 +1300

Fix bug in xmlrpc + $cfg->usersuniquebyusername

Bug 1556692: When used together, these can cause problems when
the ID field from Moodle gets truncated to the default
get_new_username() length of "30", when being inserted into
usr.username in Mahara.

behatnotneeded: Can't test Mnet in Behat

Change-Id: Icdeb78b5298e7d63a0610987b0d8fad34e58d036

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6136
Committed: https://git.mahara.org/mahara/mahara/commit/2c15de2f78d0086b45d11e2822ebc4bffbf367c8
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 2c15de2f78d0086b45d11e2822ebc4bffbf367c8
Author: Robert Lyon <email address hidden>
Date: Thu Mar 3 16:02:14 2016 +1300

Fix bug in xmlrpc + $cfg->usersuniquebyusername

Bug 1556692: When used together, these can cause problems when
the ID field from Moodle gets truncated to the default
get_new_username() length of "30", when being inserted into
usr.username in Mahara.

behatnotneeded: Can't test Mnet in Behat

Change-Id: Icdeb78b5298e7d63a0610987b0d8fad34e58d036

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6135
Committed: https://git.mahara.org/mahara/mahara/commit/b0cf1d0fff1a1c234d46ffba6958ed1879dcb4d7
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit b0cf1d0fff1a1c234d46ffba6958ed1879dcb4d7
Author: Robert Lyon <email address hidden>
Date: Thu Mar 3 16:02:14 2016 +1300

Fix bug in xmlrpc + $cfg->usersuniquebyusername

Bug 1556692: When used together, these can cause problems when
the ID field from Moodle gets truncated to the default
get_new_username() length of "30", when being inserted into
usr.username in Mahara.

behatnotneeded: Can't test Mnet in Behat

Change-Id: Icdeb78b5298e7d63a0610987b0d8fad34e58d036

no longer affects: mahara/16.04
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.