Drupal's character restrictions on {users}.name are loose enough that it causes some headaches in two scenarios. I'll pick on Gábor because he's got both spaces and non-ANSI characters.
- Authenticated access over SSH. Command line probably works pretty well, but less-robust GUI clients might not be very happy with
'Gábor Hojtsy'@git.drupal.org:project/drupal.git. - Generating URL aliases for sandbox projects. We really want to be able to provide sandbox URLs that look like this:
git@git.drupal.org:sandbox/sdboyer/!sandboxshortname.git. For launch, we almost certainly won't be able to get shortnames for the sandbox repos themselves, but we can at least get the user namespace in there. So we need to avoid situations like Gábor would have:git@git.drupal.org:sandbox/G%C3%A1bor%20Hojtsy/1234567.git(which is whatrawurlencode('Gábor Hojtsy')spits out), since that basically defeats the purpose of having a username-based human-readable URLs in the first place.
So, we need everyone who wants to use Git to have a URL-safe version of their username to use. That means /[A-Za-z0-9_-]/ is the acceptable range, I think. For existing CVS accounts this is pretty easy, as we already have the CVS username and it complies quite well with that restriction.
This data should have its own table, and should be attached to $user in hook_user(). It should be controlled via a form element on the 'Git' user category (#1034612: Create a 'Git' user category and move all Git-related pieces into it). Very important - once set, the Git username CANNOT be changed. We build URIs based on it, and we can't be setting up tons of redirects all over the place. Once it's picked, it's locked in. Lots of warnings should be given to this effect, probably with a separate confirmation form when trying to set the data.
Existing CVS users will be locked in to the name they picked for CVS. For non-CVS activated accounts, they'll need to pick a username; a username suggestion should be provided by stripping any illegal characters from their username, then ensuring that suggestion's uniqueness.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | drupalorg-n1034634-4.patch | 4.7 KB | damienmckenna |
Comments
Comment #1
sdboyer commentedTagging, and also noting that if the username described here hasn't been set, the 'Git user' permission should not be allocated in the updates to the hook_user() logic that'll happen as part of #1034648: Decouple 'Git user' role from checkbox & make admins capable of disabling git access.
Comment #2
sdboyer commentedNote that if you volunteer to work on this, you don't have to worry about importing the historical data - I'll handle that as part of the migration scripts. Which means this code will _always_ be deployed in an environment where the table is populated with CVS user information, and that data should be indistinguishable from any data that's added subsequently (in other words, we special-case nothing - we're pretending CVS never existed :D).
Comment #3
damienmckennaA few brief questions to iron out specifics:
Comment #4
damienmckennaSome initial groundwork: creates the schema ("users_git") along with an update hook to add it if needed, adds the field to the user form, and then handles inserting/updating/deleting the git username ("git_name"). There's no logic for any of the requirements, it's just some quick skeletal work before I get some shut-eye ;-)
Comment #5
sdboyer commentedWoot! I love it when tweets snag someone in :)
Looks like a solid start. I'd say that we could probably stand to use just 64 characters for the username, and that if you hadn't already written an update function, you don't need to (new schema and we constantly reinstall this from scratch, never really update). Apart from that, this issue is pretty tied up with the other two issues referenced in the original post and my first comment, and it'll be difficult to finish up without those two coming along with.
But yeah, a good start, and thanks for stepping up!
Comment #6
Josh The Geek commentedBut what if I don't like my CVS username? My CVS user is joshthegeek, and I would like to be JoshTheGeek.
Comment #7
sdboyer commentedWe can make a special, one-time-change list of CVS usernames that get changed during the migration process, no problem. Probably best to start an issue where people post their requested changes, including the old and new username. I know, for example, that CVS restricts underscores, and mikey_p would really like to be mikey_p, not mikeyp...
@Josh The Geek - Maybe you'd be willing to take responsibility for coordinating such an issue, and making pull requests as needed to the migration scripts to keep it in sync with the requests people make? Once the initial logic is written (which it isn't yet, not until this patch goes in), it should just be a matter of adding a key/value pair somewhere in https://github.com/sdboyer/drupalorg-git/blob/import-all-staging/db-migr... .
Comment #8
sdboyer commented@DamienMcKenna - Thanks for the kickstart, I'm gonna wrap this one up myself.
Comment #9
sdboyer commentedOK, this is almost completely done. The only thing I haven't implemented is an additional validation step - I really want a separate confirm form that folks have to pass through before making the permanent, irreversible step. I've opened another issue for that, #1036114: Add an additional confirmation step when choosing the Git username, but we can tackle that next sprint as it's not at all a testing blocker. So this one can be marked fixed.
Other than that, though, this is all set up, and the migration scripts also account for moving old CVS usernames (only for confirmed CVS accounts) over to the new Git usernames: https://github.com/sdboyer/drupalorg-git/blob/import-all-staging/db-migr...
@Josh The Geek - like I said, I'd really like it if you were to coordinate an issue where people can express a preference for a name change. There's no conflicts with anything else we're doing, so people should feel free to do it. Only problem would be if two people request the same name - and in that case, first-come first-served. As people respond to that issue, you can send me more pull requests :)
Comment #10
Josh The Geek commentedsdboyer: #1036140: Respond here if you want your CVS username changed when moving to Git