Opened 13 years ago

Last modified 10 years ago

#199 new defect

Case-sensitive username matching

Reported by: adehnert Owned by:
Priority: normal Milestone: Sometime
Component: People Version:
Keywords: Cc:
Size: medium

Description

When matching usernames (eg, on the people management page) we should do a case-sensitive match. At the moment, people can add "Anandk" as having office access, which breaks space/dump/office-access.csv (see https://diswww.mit.edu/menelaus/asa-db/4203, for example).

Change History (7)

comment:1 Changed 13 years ago by adehnert

I've verified that this is doable from the usual "update people" interface.

comment:2 Changed 13 years ago by adehnert

Apparently under sqlite this is done case-sensitive and on mysql it's case-insensitive...

comment:3 Changed 12 years ago by adehnert

I think the proper solution involves the South equivalent of "ALTER TABLE groups_athenamoiraaccount MODIFY username varchar(8) COLLATE utf8_bin;"; I did this on db2.0 and it started giving me errors when editing https://asa.scripts.mit.edu/db2.0/groups/1923/edit/people. We probably also want to lower-case all the existing username fields.

comment:4 Changed 12 years ago by adehnert

Fields that need to be lowercased:

  • groups_groupstartup: president_kerberos, treasurer_kerberos (four groups involved: one has N/A for the fields, one has both wrong, and one each have only president/treasurer wrong)
  • groups_groupnote should not get updated: author includes some @SYSTEM accounts
  • groups_officeholder: person (190 entries)
  • groups_athenamoiraaccount should not get updated -- it's autoloaded, presumably correctly

comment:5 Changed 12 years ago by adehnert

Useful references:

Last edited 12 years ago by adehnert (previous) (diff)

comment:6 Changed 12 years ago by adehnert

Apparently comparing between non-matching collations works poorly, so we're going to need to change more than just the one column's collation. (I'm guessing we want to change the default collation for the DB, long term? *sigh* I guess sqlite is already case-sensitive, so it's not like case-sensitivity is a disaster.)

Also, it turns out the space dump cares about other issues -- trailing spaces in usernames. I have no idea how *those* happened, but there were about 42 in the prod DB (which I just fixed).

comment:7 Changed 10 years ago by adehnert

Django doesn't have an API for setting this, so we're probably going to need to include raw SQL in a migration, I guess? See https://docs.djangoproject.com/en/1.8/ref/databases/#collation-settings.

Note: See TracTickets for help on using tickets.