Bug #10276

Global setting for reference code separator affects new user slug generation

Added by Dan Gillean about 4 years ago. Updated almost 4 years ago.

Status:VerifiedStart date:09/06/2016
Priority:CriticalDue date:
Assignee:-% Done:

0%

Category:User management
Target version:Release 2.3.1
Google Code Legacy ID: Tested version:2.3, 2.4
Sponsored:No Requires documentation:

Description

First reported in the AtoM User Forum here in 2.2; reproduced in qa/2.4.x

  • Change the Reference code separator setting in Admin > Settings > Global from the default "-" dash to a period "."
  • Save
  • Create a new user, save
Resulting error
  • when the random new user slug is generated, it will include a period instead of a dash
  • Using a period in the URL is not valid in AtoM
  • Depending on AtoM version, this means either:
  • You get a 500 error, or
  • You get a page not found message every time you try to view the user, making their user page inaccessible
Expected result
  • Default separator does not affect slug generation anywhere in the application
  • New users can be created and their user profile page access regardless of the separator character used

Notes

It seems that the separator value is being checked in the slugify function - in fact, AtoM should always use dashes as the separator for slugs. The separator value should ONLY be checked when generating reference codes.

See: https://github.com/artefactual/atom/blob/stable/2.3.x/lib/model/QubitSlug.php#L28

10276-separator-fix.php Magnifier (530 Bytes) Steve Breker, 11/07/2016 03:03 PM

History

#1 Updated by Dan Gillean about 4 years ago

  • Description updated (diff)
  • Priority changed from Medium to High

Updated description with links to User Forum report and to likely cause of issue in AtoM's code, via GitHub.

#2 Updated by David Juhasz about 4 years ago

  • Subject changed from Global setting for reference code separator affects new user slug generation to Global setting for reference code separator affects new user slug generation
  • Priority changed from High to Critical

This is creating slugs that break the ability to edit events as well. Elevating to critical.

#4 Updated by David Juhasz about 4 years ago

  • Target version set to Release 2.3.1

#5 Updated by Nick Wilkinson about 4 years ago

  • Assignee set to Steve Breker

#6 Updated by Steve Breker about 4 years ago

  • Status changed from New to Code Review
  • Assignee changed from Steve Breker to Nick Wilkinson

Ready for code review in qa/2.4.x.

https://github.com/artefactual/atom/pull/456

#7 Updated by Jesús García Crespo about 4 years ago

  • Status changed from Code Review to Feedback
  • Assignee changed from Nick Wilkinson to Steve Breker

I'm not sure if we can include a new migration in 2.3.1, should we do that? Can we discuss on Monday and check with the rest of the team? The PR is fine as long as it's only merged into qa/2.4.x - we may have to find other ways to fix the data for 2.3 users, e.g. tools:run script?

#8 Updated by Steve Breker about 4 years ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from Steve Breker to Dan Gillean

At Jesús and David's suggestion, I have dropped the migration program. Correcting existing separators in the database will be accomplished with a tools:run CLI script.

#10 Updated by Steve Breker about 4 years ago

Run the script to correct values in the slug table as with any tools:run script:

e.g.

php symfony tools:run 10276-separator-fix.php

#11 Updated by Dan Gillean about 4 years ago

  • Status changed from QA/Review to Verified
  • Assignee changed from Dan Gillean to Steve Breker

Tested in 2.4 that I could change the separator to a period, and still create new users (dashes are used; separator is ignored) and edit events. Tested in 2.3 that I could break a user based on this issue's description, and then run the attached php script and resolve the issue.

Steve, I think this can be merged to 2.3.1 now.

#12 Updated by Steve Breker about 4 years ago

  • Status changed from Verified to Deploy
  • Assignee changed from Steve Breker to Nick Wilkinson

Cherry pick to stable/2.3.x complete. Ready for deployment to client site.

See attached script to be run on sites (using tools:run) experiencing this issue. Script will correct data in slug table to use the correct separator.

#13 Updated by Nick Wilkinson about 4 years ago

  • Assignee deleted (Nick Wilkinson)

#14 Updated by David Juhasz about 4 years ago

  • Status changed from Deploy to Document
  • Assignee set to Dan Gillean
  • Requires documentation set to Yes
  • Tested version deleted (2.2, 2.2.1)

Script to correct problem characters should be documented.

#15 Updated by Dan Gillean about 4 years ago

I've added the script to a public gist, here - will add some basic instructions to the wiki.

#16 Updated by Dan Gillean almost 4 years ago

  • Status changed from Document to Verified
  • Assignee deleted (Dan Gillean)

Instructions added to 2.3 docs in the settings page for the reference code separator - see: https://github.com/artefactual/atom-docs/commit/3d2bd4cc0b262d6316f7794c21163ac9e1c0442f

Also created a placeholder 2.3.1 release wiki page and added the instructions there: https://wiki.accesstomemory.org/Releases/Release_announcements/Release_2.3.1

Finally, updated the 2.3 release page with a "known issues" section that also includes the fix instructions. https://wiki.accesstomemory.org/Releases/Release_announcements/Release_2.3#Known_Issues

#17 Updated by Dan Gillean almost 4 years ago

  • Requires documentation deleted (Yes)

Also available in: Atom PDF