Make references to users be foreign key instead of string matches
authorMagnus Hagander <magnus@hagander.net>
Tue, 11 Aug 2020 14:32:57 +0000 (16:32 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 11 Aug 2020 14:55:49 +0000 (16:55 +0200)
commit347896fa4718e1b724a2adcc2f046791cf11cb17
tree7455825522768d4a9f894cb400d6b59041c7ec6a
parent07ef5b7a8181992a5d4fe5c08a8d94dd551096db
Make references to users be foreign key instead of string matches

We've previously done string matching on usernames which comes with all
sorts of problems :/

Instead, do a proper foreign key to the users model. Our authentication
system already (and for a long time) supports importing a user by email
address from upstream if the user doesn't exist, so instead update the
integration to do that when adding new users with permissions.

NOTE! Prior to deploying this migration all users referenced in the
permissions and ssh tables *must* exist in auth_users, otherwise the
migration will fail.
gitadmin/gitadmin/adm/forms.py
gitadmin/gitadmin/adm/migrations/0002_user_foreign_key.py [new file with mode: 0644]
gitadmin/gitadmin/adm/models.py
gitadmin/gitadmin/adm/templates/repoview.html
gitadmin/gitadmin/adm/util.py [new file with mode: 0644]
gitadmin/gitadmin/adm/views.py
gitdump.py
keysync.py
pggit.py