Opened 4 years ago

Closed 9 months ago

#1140 closed enhancement/feature request (fixed)

TRAC: Bad to read usernames

Reported by: usul Owned by: kazer
Priority: major Milestone: version 0.5.1
Component: www Version:
Severity: normal Keywords: trac, login, openid
Cc: sebastian.leske@…, http://wiki.navit-project.org/index.php/user:mvglasow, (2)

Description

Hi, currently we force contributors/team to use OpenID in combination with the wiki-auth which is IMHO a good idea. Unfortunately, Trac uses this URL as username and so every list/page in trac is spammed by XXL nicknames. Can we somehow please strip that strings down?

Attachments (2)

trac-user-name-cleanup.sql (9.7 KB) - added by sleske 12 months ago.
Delete unused accounts, create list of renamings.
rename-trac-users.sql (3.4 KB) - added by sleske 12 months ago.
Rename / join user accounts.

Download all attachments as: .zip

Change History (32)

comment:1 Changed 4 years ago by sleske

Just had a look into this problem. While a very good idea, this may unfortunately be a bit difficult.

Apparently, there is no official support in trac for renaming a user. So this would have to be done manually in the database, which requires full server access (i.e. probably root rights on the trac server). I think only cp15 has this.

Also, the trac plugin we use for OpenID is apparently the one from https://github.com/dairiki/authopenid-plugin . This plugin automatically generates the username from the OpenID data; we'd also have to reconfigure it to generate the new "nicer" user names. This would also need to be investigated.

comment:2 Changed 4 years ago by usul

  • Component changed from tools to www
  • Keywords openid added
  • Milestone set to version 0.5.1
  • Owner changed from KaZeR to cp15

Thanks for the infos :) I still think that this work is worth, as you create different users depending on camelcase and http(s) prefix which is very confusing and blocks the interaction with trac.

comment:3 Changed 4 years ago by sleske

Yes, I very much agree it is worth it. It's just that the internals of trac and of the OpenID plugin make it a bit difficult.

BTW, I'd like to help with this, if there's interest. However, I'd need access to the trac server. Is there a way to get server access?

comment:4 Changed 3 years ago by sleske

  • Severity set to normal

Update: I created a patch for the ​authopenid-plugin on GitHub? ( https://github.com/dairiki/authopenid-plugin ), to not generate a new username for a known OpenID identifier. If it is accepted, it would allow renaming a trac user without the plugin interfering.

Once the patch is accepted, we could upgrade our trac to use the new plugin version; then we could start renaming users :-).

comment:5 Changed 3 years ago by sleske

My patch for the authopenid-plugin has been accepted upstream, and is included in the new V0.4.7 (already available on PyPi) :-).

Now the authopenid-plugin will no longer create a new account if the account name and the profile information returned by the OpenID provider do not match. Instead the account will be looked up by the OpenID URL. That way the plugin will not create a new account if an account was renamed.

Also, I have received a dump of the trac database, and have prepared an SQL script to rename/merge user accounts. So the next steps would now be:

1) Run the SQL script (see attachment) against the trac DB. The SQL script will rename/merge all user accounts that are listed in a special table (rename_user). The attached script only corrects my own accounts as a final test (I already tested it locally); later we can use it for other accounts.

2) Upgrade the authopenid-plugin in our trac installation to 0.4.7.

3) Correct the names of all users. There are currently 344 "ugly" user names (URL as name) in trac. The main providers are the Navit Wiki, google.com and myopenid.com. We'll have to see if correcting all names makes sense, as it is not always clear which short name to use. Only 72 of the 344 users have logged in in the last two years, it probably makes sense to limit corrections to these.

comment:6 Changed 3 years ago by sleske

I have also mailed all trac users who use an OpenID from MyOpenID ( https://www.myopenid.com/ ). MyOpenID will shut down in February 2014, so these users (which includes me) must register with a new OpenID.

Logging in with a new OpenID will create a new trac account. We can then merge the old and new account when users request it.

comment:7 Changed 3 years ago by usul

  • Priority changed from minor to major

I suggest a higher priority as this is still very annoying and makes communication/managing issues still very complex

comment:8 Changed 3 years ago by sleske

As explained in the comments above, there is already a solution (new plugin which creates nicer user names + script for renaming existing users). However, someone with access to the trac server must apply it, and I don't have access. I have tried contacting KaZer?, but it seems he is busy. Is there some other way to get the changes onto the server?

comment:9 Changed 3 years ago by sleske

  • Cc sebastian.leske@… added

comment:10 Changed 3 years ago by kazer

  • Owner changed from cp15 to kazer
  • Status changed from new to assigned

comment:11 Changed 3 years ago by sleske

The attached script has been run against the trac database - you'll note I'm "sleske" now in trac :-). Thanks, KaZeR!

We now have a script to rename and merge accounts. Now we can rename any accounts that should get a nicer name.

At least we should probably rename the accounts with a Wiki URL (like "http://wiki.navit-project.org/index.php/user:kazer") to their short name. Any other ideas?

comment:12 follow-up: Changed 3 years ago by mvglasow (2)

Doesn't work for me... I still see the full Wiki URL as my username.

However, this whole thing used to work: when I first signed up, I could just sign in with my Wiki username and was simply "Mvglasow". (I think this was before OpenID got introduced.) Then, at some point, something broke (I remember opening a ticket for this) and I could no longer log in with my Wiki account. This got fixed, and I've had the full URL as a user name ever since – but only for new edits, while the old ones retained the short username. Maybe something needs to be merged in cases like mine.

comment:13 in reply to: ↑ 12 Changed 3 years ago by sleske

Replying to http://wiki.navit-project.org/index.php/user:mvglasow (2):

Doesn't work for me... I still see the full Wiki URL as my username.

Yes, of course - the renaming has not happened (yet). As explained in the comments, we must a) come up with a list of user names to rename, and then b) actually do it.

However, this whole thing used to work: when I first signed up, I could just sign in with my Wiki username and was simply "Mvglasow". [...] and I've had the full URL as a user name ever since – but only for new edits, while the old ones retained the short username. Maybe something needs to be merged in cases like mine.

I'm not sure exactly what happened, but yes, there are various ways of ending up with multiple user names. My script can merge multiple user names into one (I also had multiple user names).

At the moment, only KaZeR (and cp15) have the access required to rename accounts, so for now you'll have to ask them to fix user names. I'll try to get access as well, then I could do it, too.

comment:14 follow-up: Changed 21 months ago by kazer

  • Milestone changed from version 0.5.1 to version 0.5.0

comment:15 in reply to: ↑ 14 Changed 21 months ago by sleske

Replying to http://wiki.navit-project.org/index.php/user:kazer:

Kazer, is there any progress on this problem? Could you give me the necessary rights to perform the name changes? Or if you prefer, send me an up-to-date trac database dump. Then I can prepare an SQL script to do the renaming, and you can run it yourself.

Then we could finally close this issue...

comment:16 Changed 17 months ago by kazer

Sebastian, would you like to schedule a quick IRC meeting to get this done? Feel free to ping me anytime.

comment:17 Changed 17 months ago by mvglasow (2)

  • Cc http://wiki.navit-project.org/index.php/user:mvglasow (2) added

comment:18 Changed 12 months ago by sleske

It's taken a while, but now the cleanup script is done. There are two scripts (both attached): trac-user-name-cleanup.sql and rename-trac-users.sql.

trac-user-name-cleanup.sql will delete unused user accounts, and calculate a list of account renamings (in table rename_user). rename-trac-users.sql will rename the accounts.

These two scripts need to run against the trac database - first trac-user-name-cleanup.sql , then rename-trac-users.sql. Then the user names should be more readable.


The cleanup scripts (try to) correct three problems:

  • multiple accounts created for one OpenID URI
  • ugly OpenID URIs as user names
  • multiple accounts with equivalent OpenID URIs (such as http and https URIs)

Multiple accounts with the same or equivalent OpenID URIs are merged. "Ugly" user names are simplified - for Navit wiki URIs, the user name is extracted, for others at least the "http(s):" prefix is stripped.

Some problems still remain:

There are similar user names (probably the same user), that use different OpenID URIs. These were not merged, because it is unclear if they are really the same user.

Some user names have no OpenID URI associated, probably because old versions of the trac OpenID plugin did not store the OpenID URI. When these accounts collided with another account after the joining and simplification described above, they were merged (as accounts without an OpenID URI are inaccessible anyway with the new version of the OpenID trac plugin). However, non-colliding accounts are retained, but are effectively locked because they have no OpenID URI associated.

These problems can be corrected later if desired.

Changed 12 months ago by sleske

Delete unused accounts, create list of renamings.

Changed 12 months ago by sleske

Rename / join user accounts.

comment:19 Changed 11 months ago by kazer

Scripts applied. Everything looks good as far as I can tell. mvglasow used to have the long username, and his comment in this ticket is now showing just his username.

Nice work sleske! And thank you for not giving up on this!

comment:20 follow-up: Changed 11 months ago by kazer

Ha, there might be a side effect regarding notifications : "Warning: The change has been saved, but an error occurred while sending notifications: 435"

comment:21 Changed 11 months ago by kazer

Test comment for notifications logs.

comment:22 Changed 11 months ago by kazer

Log :

2016-06-01 23:46:26,289 Trac[notification] INFO: Email address w/o domain: mvglasow (2)
2016-06-01 23:46:26,289 Trac[notification] INFO: Email address w/o domain: usul
2016-06-01 23:46:26,289 Trac[notification] INFO: Email address w/o domain: kazer
2016-06-01 23:46:26,289 Trac[notification] INFO: Email address w/o domain: http://wiki.navit-project.org/index.php/user:mvglasow
2016-06-01 23:46:26,289 Trac[notification] INFO: Invalid email address: (2)

comment:23 in reply to: ↑ 20 ; follow-up: Changed 11 months ago by sleske (2)

Replying to kazer:

Ha, there might be a side effect regarding notifications : "Warning: The change has been saved, but an error occurred while sending notifications: 435"

I have seen this message before - I think one or two days ago. So I don't think it is caused by my scripts (which cannot have bugs anyway, obviously ;-) ).

Still, that should be investigated.

comment:24 in reply to: ↑ 23 Changed 11 months ago by sleske

Replying to 23:

I have seen this message before - I think one or two days ago. So I don't think it is caused by my scripts (which cannot have bugs anyway, obviously ;-) ).

Oops, I'll take that back. I overlooked the fact that session_attribute also stores an (optional) email address. When merging trac accounts, stuff from session_attribute is only kept for one account - so if the account that is kept did not have an email set, there will be none. Looks like trac then tries to use the user name as the mail address, and notes it is not valid.

I could hack up an additional script that restores email addresses (using the old dump you gave me) - or people can just set their address in "Preferences". I'll see what I can do.

comment:25 follow-up: Changed 11 months ago by kazer

I do have a backup of the db right before the change, if needed.

comment:26 in reply to: ↑ 25 Changed 11 months ago by sleske

Replying to kazer:

I do have a backup of the db right before the change, if needed.

Excellent. Could you send it to me (email)? I'll extract the old email addresses, and send back a script.

comment:27 Changed 11 months ago by kazer

Email sent!

comment:28 Changed 9 months ago by kazer

Got the latest patch from sleske, and it has been applied.

comment:29 Changed 9 months ago by sleske

The email addresses that were lost during the account merge/rename have been restored. Thanks kazer!

There will still be many accounts w/o an email address, and if a notification is triggered for them, there will still be a message in the log as above ("Email address w/o domain"). This will only go away if people set an email address in their preferences... trac is weird like that.

comment:30 Changed 9 months ago by sleske

  • Resolution set to fixed
  • Status changed from assigned to closed

With the restored email addresses I think we are done here. There are still ugly user names; to get them corrected, please contact KaZeR, who has the necessary access to rename them. If you are not getting email notifications, check your address under "Preferences".

Finally we can close this ticket. I just turned three years, and was almost ready to start daycare :-).

Note: See TracTickets for help on using tickets.