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

✨ Invitations to register to product 🚨 #4739

Merged
merged 28 commits into from
Nov 16, 2023

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Sep 12, 2023

What do these changes do?

Invitation links allows a user to register a new account. The invitation is bound to an email and now also to a product. That means that

  • invitations will only allow registration in bound products
  • invitations can also be used to add an existing user to a different product (e.g. a user has an account in a deploy with product A and but not B. Now we can create an invitation link to add user to product B as well)
    • WARNING: for the moment there is not check to prevent e.g. commercial users from being invited to non-commercial products)

NOTE that this PR addresses invitations BUT login bound to product is coming in a subsequent PR.

Highlights

  • 🎨 webserver.invitations plugin
    • validates invitation.product == current_product
    • validates invitation is used
  • webserver.login plugin
    • ♻️ started refactoring towards Controller-Service-Repository (SEE /docs/coding-conventions.md)
  • 🐛 fixes order in list_products

Related issue/s

How to test

Driving test is services/web/server/tests/unit/with_dbs/03/invitations/test_invitations.py

  • 🚨 needs manual testing
    • PO generate an invitation
    • use it for a new account
    • PO

DevOps

None

@pcrespov pcrespov added this to the the nameless milestone Sep 12, 2023
@pcrespov pcrespov self-assigned this Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #4739 (d9634d9) into master (163d47f) will decrease coverage by 0.6%.
Report is 1 commits behind head on master.
The diff coverage is 95.2%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4739      +/-   ##
=========================================
- Coverage    81.8%   81.3%    -0.6%     
=========================================
  Files        1162     524     -638     
  Lines       48514   26592   -21922     
  Branches      748     198     -550     
=========================================
- Hits        39704   21628   -18076     
+ Misses       8651    4914    -3737     
+ Partials      159      50     -109     
Flag Coverage Δ
integrationtests 65.0% <60.3%> (+<0.1%) ⬆️
unittests 86.3% <95.2%> (+7.3%) ⬆️

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

Files Coverage Δ
...rc/simcore_service_webserver/invitations/plugin.py 100.0% <100.0%> (+28.5%) ⬆️
...r/src/simcore_service_webserver/login/_auth_api.py 100.0% <100.0%> (ø)
...c/simcore_service_webserver/login/_registration.py 75.0% <100.0%> (+28.9%) ⬆️
...c/simcore_service_webserver/login/handlers_auth.py 97.8% <100.0%> (+33.1%) ⬆️
...erver/src/simcore_service_webserver/login/utils.py 100.0% <100.0%> (+10.6%) ⬆️
...ver/src/simcore_service_webserver/products/_api.py 69.2% <100.0%> (+26.1%) ⬆️
.../src/simcore_service_webserver/products/_events.py 93.6% <100.0%> (+0.1%) ⬆️
...simcore_service_webserver/products/_middlewares.py 100.0% <100.0%> (ø)
...e_service_webserver/login/handlers_registration.py 89.7% <87.5%> (+43.1%) ⬆️
...src/simcore_service_webserver/invitations/_core.py 75.9% <88.2%> (+43.1%) ⬆️

... and 879 files with indirect coverage changes

@pcrespov pcrespov added a:webserver issue related to the webserver service a:invitations invitations service labels Sep 12, 2023
@pcrespov pcrespov changed the title ✨ Is4546/invitation per product WIP: ✨ Is4546/invitation per product Sep 12, 2023
@pcrespov pcrespov force-pushed the is4546/invitation-per-product branch 2 times, most recently from 08dbb5d to 05fe78b Compare September 20, 2023 08:36
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@pcrespov pcrespov modified the milestones: the nameless, Microhistory Oct 24, 2023
@pcrespov pcrespov modified the milestones: Microhistory, 7peaks Nov 5, 2023
@pcrespov pcrespov force-pushed the is4546/invitation-per-product branch from 05fe78b to 036bdc7 Compare November 5, 2023 20:10
@pcrespov pcrespov changed the title WIP: ✨ Is4546/invitation per product WIP: ✨ Is4546/invitation per product (⚠️ devops) Nov 5, 2023
@pcrespov pcrespov force-pushed the is4546/invitation-per-product branch from 5ba7b7e to 7bf2baf Compare November 6, 2023 16:32
@pcrespov pcrespov changed the title WIP: ✨ Is4546/invitation per product ✨ Invitations to register an account in a product or/and to add a product to an existing account Nov 16, 2023
@pcrespov pcrespov changed the title ✨ Invitations to register an account in a product or/and to add a product to an existing account ✨ Invitations to register to product Nov 16, 2023
@pcrespov pcrespov marked this pull request as ready for review November 16, 2023 00:32
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.

Just wanted to double check with you: Currently when this signal is emited: SIGNAL_ON_USER_CONFIRMATION the default wallet is created for that user in that product, this will be still valid in this new approach of inviting users that are already in the DB to the new product? Thanks

Update: just checked, that yes, the function notify_user_confirmation would still be called which is good, so the wallet should be created 👍

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.

Looking good thanks! Looking forward for the next PR for #4776 , then we can modify the hardcoded s4l in the socketio connection

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.

Looks good, there are some asserts looking out of place to me

@pcrespov pcrespov requested a review from GitHK November 16, 2023 09:28
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!

@pcrespov pcrespov enabled auto-merge (squash) November 16, 2023 11:04
Copy link

codeclimate bot commented Nov 16, 2023

Code Climate has analyzed commit d9634d9 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.6% 0.6% Duplication

@pcrespov pcrespov merged commit 1a4b614 into ITISFoundation:master Nov 16, 2023
55 checks passed
@pcrespov pcrespov deleted the is4546/invitation-per-product branch November 16, 2023 12:21
@pcrespov pcrespov changed the title ✨ Invitations to register to product ✨ Invitations to register to product 🚨 Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:invitations invitations service a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invitations: Bound invitation to product
4 participants