Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Extends user table with username and first/second name for a user 🗃️ #5229

Merged
merged 51 commits into from
Jan 16, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Jan 12, 2024

What do these changes do?

Enhances users table by adding first/last name (previously encoded in name column) and reuses name to implement a proper "user name"'s unique identifier.

  • The username is intended to be used e.g. as in github to refer other users (e.g. @pcrespov) and in the session cookies
  • The first/last names will be used to address the user in communication templates (e.g emails/invoices/reports etc)
  • ♻️ Adapted login functionality (will be further decoupled in separate PRs)

Related issue/s

How to test

  • Driving test packages/postgres-database/tests/test_users.py
  • Migration tested against master pg dataset

Dev Checklist

DevOps Checklist

  • 🗃️ users table is modified

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (942bd7f) 87.4% compared to head (4243913) 87.2%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #5229     +/-   ##
========================================
- Coverage    87.4%   87.2%   -0.2%     
========================================
  Files        1295    1295             
  Lines       53068   53066      -2     
  Branches     1162    1164      +2     
========================================
- Hits        46382   46299     -83     
- Misses       6436    6517     +81     
  Partials      250     250             
Flag Coverage Δ
integrationtests 63.7% <66.1%> (-1.3%) ⬇️
unittests 85.2% <97.6%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...dels-library/src/models_library/projects_access.py 96.5% <100.0%> (+0.1%) ⬆️
...ackages/models-library/src/models_library/users.py 100.0% <100.0%> (ø)
...base/src/simcore_postgres_database/models/users.py 93.5% <100.0%> (-0.6%) ⬇️
...vice_api_server/api/dependencies/authentication.py 81.8% <100.0%> (ø)
...src/simcore_service_api_server/api/routes/users.py 100.0% <100.0%> (ø)
...imcore_service_api_server/db/repositories/users.py 100.0% <100.0%> (ø)
...core_service_api_server/models/schemas/profiles.py 96.9% <100.0%> (ø)
...rc/simcore_service_webserver/exporter/_handlers.py 95.1% <100.0%> (ø)
...ver/src/simcore_service_webserver/groups/_users.py 100.0% <100.0%> (ø)
...server/src/simcore_service_webserver/login/_2fa.py 84.4% <ø> (-0.2%) ⬇️
... and 15 more

... and 10 files with indirect coverage changes

@pcrespov pcrespov force-pushed the is5138/username-migration branch from c6f0dcf to 657900e Compare January 12, 2024 07:23
@pcrespov pcrespov changed the title WIP: Is5138/username migration New unique username and first/second name for a user 🗃️ Jan 12, 2024
@pcrespov pcrespov changed the title New unique username and first/second name for a user 🗃️ 🎨 Extends user table with username and first/second name for a user 🗃️ Jan 12, 2024
@pcrespov pcrespov added the a:webserver issue related to the webserver service label Jan 12, 2024
@pcrespov pcrespov added this to the This is Sparta! milestone Jan 12, 2024
@pcrespov pcrespov marked this pull request as ready for review January 12, 2024 08:37
Copy link
Collaborator

@elisabettai elisabettai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! 🎉 Looking forward to seeing it in action.
A question/suggestion on how sharing can be improved thanks to this PR. Probably the following is more related to frontend part.

  • when user A wants to share something with user B he sees the weird usernames (created from the email) we have now in the DB. Will it be possible to have here the Name Surname?
    image

Edit: @pcrespov maybe you can link this issue as well: ITISFoundation/osparc-issues#1193

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great thanks!

@pcrespov pcrespov force-pushed the is5138/username-migration branch from edbf1e2 to e905d23 Compare January 13, 2024 14:30
@pcrespov pcrespov requested a review from GitHK January 13, 2024 14:30
@pcrespov
Copy link
Member Author

pcrespov commented Jan 13, 2024

  • when user A wants to share something with user B he sees the weird usernames (created from the email) we have now in the DB. Will it be possible to have here the Name Surname?

@elisabettai the problem we had until now is that we did not have a proper "username" concept but rather a composition of "guessed" first and last name. Only if the user would update its profile it would show in there. I mean
image

This PR makes a clean separation and therefore, yes we could use either username or First+Last name in this list. I would suggest to do like github and other online tools where usernames are the default reference. Moreover in notes we can create automatically references by adding @ as in @elisabettai.

The problem with ITISFoundation/osparc-issues#1193 is that upon registration we do not know the first and last name of the user. I will add a separate PR to somehow get that info from the invitation but when the product has no required invitation the only option is to require it during registration

@pcrespov pcrespov enabled auto-merge (squash) January 13, 2024 15:46
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes 👍

Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pcrespov pcrespov force-pushed the is5138/username-migration branch from 27fa30e to ac12e4c Compare January 15, 2024 23:38
Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Added a few suggestions and questions. Sorry for the slow review.

@pcrespov pcrespov force-pushed the is5138/username-migration branch from ac12e4c to 1b538a7 Compare January 16, 2024 12:23
Copy link

sonarcloud bot commented Jan 16, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@pcrespov pcrespov merged commit 0cdb35b into ITISFoundation:master Jan 16, 2024
55 checks passed
@pcrespov pcrespov deleted the is5138/username-migration branch January 16, 2024 21:42
@elisabettai
Copy link
Collaborator

elisabettai commented Jan 31, 2024

Hi @pcrespov,
I have two questions on this PR and this comment:

The problem with ITISFoundation/osparc-issues#1193 is that upon registration we do not know the first and last name of the user. I will add a separate PR to somehow get that info from the invitation but when the product has no required invitation the only option is to require it during registration

In sim4life.io (a product with invitation and where First Name and Last Name are mandatory):

  1. Will new users have their First Name and Last Name added to the DB?
  2. Can then First Name and Last Name, if available, used in the UI (e.g. in default wallet name and welcome message as mentioned in Improve default user name osparc-issues#1193)?

@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Feb 14, 2024
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add username
6 participants