Page MenuHomeSoftware Heritage

auth: Add UserMailmap model and edition endpoints
ClosedPublic

Authored by anlambert on Feb 3 2022, 3:18 PM.

Details

Summary

Add a new database table to store mailmap settings that will be
used to add display names for an authors that can be found in the
archive.

Add endpoints to add or update these mailmap settings restricted
to staff users or users with special permission.
They will be used in the upcoming Web UI to manage mailmaps.

Diff Detail

Repository
rDWAPPS Web applications
Branch
auth-mailmap-model
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26496
Build 41436: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 41435: arc lint + arc unit

Event Timeline

Update years in license headers

vlorentz published this revision for review.Feb 3 2022, 3:31 PM
vlorentz added a subscriber: vlorentz.

Looks great, thanks. Some minor change requests below

swh/web/auth/mailmap.py
25

I don't think everyone in the staff should have access to this, this seems very sensitive

swh/web/auth/models.py
28

why not a nullable foreign key to the user table?

34

is this the default?

49

ditto

vlorentz requested changes to this revision.Feb 3 2022, 3:31 PM
This revision now requires changes to proceed.Feb 3 2022, 3:31 PM

Build has FAILED

Patch application report for D7073 (id=25664)

Rebasing onto f990d789aa...

Current branch diff-target is up to date.
Changes applied before test
commit f375cc01b19cef7b9729722f873184a299105edd
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Feb 3 13:47:43 2022 +0100

    auth: Add UserMailmap model and edition endpoints
    
    Add a new database table to store mailmap settings that will be
    used to add display names for an authors that can be found in the
    archive.
    
    Add endpoints to add or update these mailmap settings restricted
    to staff users or users with special permission.
    They will be used in the upcoming Web UI to manage mailmaps.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1313/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1313/console

Build has FAILED

Patch application report for D7073 (id=25665)

Rebasing onto f990d789aa...

Current branch diff-target is up to date.
Changes applied before test
commit ca9ef5d15a350f9f609859e22e335798a4383d96
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Feb 3 13:47:43 2022 +0100

    auth: Add UserMailmap model and edition endpoints
    
    Add a new database table to store mailmap settings that will be
    used to add display names for an authors that can be found in the
    archive.
    
    Add endpoints to add or update these mailmap settings restricted
    to staff users or users with special permission.
    They will be used in the upcoming Web UI to manage mailmaps.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1314/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1314/console

swh/web/auth/mailmap.py
25

ack

swh/web/auth/models.py
28

Because we do not use the user table in swh-web (apart when developing with the sqlite backend).
In production, django User objects are created from Keycloak JWT tokens and not saved to database.

That field is mostly useful to filter the mailmaps of an user in the web UI and it is a char one to
work under postgres and sqlite backends.

34

Yes, why should it not be ?

Remove endpoints access to staff users.

Build has FAILED

Patch application report for D7073 (id=25665)

Rebasing onto f990d789aa...

Current branch diff-target is up to date.
Changes applied before test
commit ca9ef5d15a350f9f609859e22e335798a4383d96
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Feb 3 13:47:43 2022 +0100

    auth: Add UserMailmap model and edition endpoints
    
    Add a new database table to store mailmap settings that will be
    used to add display names for an authors that can be found in the
    archive.
    
    Add endpoints to add or update these mailmap settings restricted
    to staff users or users with special permission.
    They will be used in the upcoming Web UI to manage mailmaps.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1314/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1314/console

Test failures are not related to these changes, need to investigate.

Is it possible to have a dedicated (eventually staff only if it's sensible) task (and 'related to TXYZ' to the diffs) about the needs regarding the overall changes you are introducing please (for historical purpose)?

(even if there is nothing in the task yet ;)

Build has FAILED

Patch application report for D7073 (id=25666)

Rebasing onto f990d789aa...

Current branch diff-target is up to date.
Changes applied before test
commit ffe0051b2c2a24126a011522774b182e651e7529
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Feb 3 13:47:43 2022 +0100

    auth: Add UserMailmap model and edition endpoints
    
    Add a new database table to store mailmap settings that will be
    used to add display names for an authors that can be found in the
    archive.
    
    Add endpoints to add or update these mailmap settings restricted
    to staff users or users with special permission.
    They will be used in the upcoming Web UI to manage mailmaps.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1316/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1316/console

Test failures are not related to these changes, need to investigate.

Fixed in D7076

swh/web/auth/models.py
28

ok

34

I just wanted to be sure

This revision is now accepted and ready to land.Feb 3 2022, 4:13 PM

Build is green

Patch application report for D7073 (id=25674)

Rebasing onto eebb27ebdb...

Current branch diff-target is up to date.
Changes applied before test
commit f2cf669b55deca5f263ad9498c946b38c694d01a
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Feb 3 13:47:43 2022 +0100

    auth: Add UserMailmap model and edition endpoints
    
    Add a new database table to store mailmap settings that will be
    used to add display names for an authors that can be found in the
    archive.
    
    Add endpoints to add or update these mailmap settings restricted
    to staff users or users with special permission.
    They will be used in the upcoming Web UI to manage mailmaps.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1318/ for more details.