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

Invite users via email #4539

Merged
merged 83 commits into from
Jul 2, 2024
Merged

Invite users via email #4539

merged 83 commits into from
Jul 2, 2024

Conversation

galvana
Copy link
Contributor

@galvana galvana commented Dec 21, 2023

Closes https://ethyca.atlassian.net/browse/PROD-1553

Description Of Changes

Invite users by email!

Initial design doc here: https://ethyca.atlassian.net/wiki/spaces/EN/pages/2872344650/Hackathon+2023+-+Team+1

Code Changes

Frontend

  • Adds email field to user creation/edit flow
  • Conditionally render setting up a different user's password—only go through this flow if email messaging is not enabled. Otherwise rely on emailing the user to have them set up their own password and activate their own account
  • User page and overall user table now have fields for email as well as a badge for if invite is pending
  • Refactor login page to use our more standard components (this lets us toggle to see the password!)
  • Render a login page with different copy if visiting the url with an invite code- the username field is disabled and prefilled
  • Call new accept invite endpoint when "logging in"
  • URLs now 'persist' through login, i.e. if you visited /user-management while not logged in, got redirected to the login page, then signed in, you'll automatically be redirected to /user-management (where in the past, you'd go to the home screen)
  • sneaky lil animation for logging in

Backend

  • Exposes whether email messaging is enabled via the health endpoint
  • Email is now a required field on creating new users
  • User object has two additional attributes: disabled and disabled_reason. A user pending an invite would have disabled=true and disabled_reason="pending_invite"
  • Flow for sending an email with an invite code when a user is created
  • New endpoint for accepting an invite
  • Updated the create user CLI command to require an email

Steps to Confirm

  • Add FIDES__ADMIN_UI__URL="http://localhost:3000" to your .env file
  • Configure email messaging via the API, the Fides Postman collection makes this easy to do with these two API calls
    • Messaging Config - Email > Post Messaging Config
    • Messaging Config - Email > Messaging Config Secrets
  • In the Admin UI, navigate to Management > User Management and click Add New User
    • Fill out the form with an email address you have access to. Verify the password field is disabled, that's a quick way to verify that "invite users via email" is properly configured
  • Check your email, open the invite link in an incognito window to avoid conflicting with your current Admin UI session
  • Provide a password and submit, you should be redirected to the Admin UI landing page

Pre-Merge Checklist

Copy link

vercel bot commented Dec 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Jul 2, 2024 1:41am

Copy link

cypress bot commented Dec 21, 2023

Passing run #8665 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge 9b3e248 into a01735f...
Project: fides Commit: 9054df61bf ℹ️
Status: Passed Duration: 00:40 💡
Started: Jul 2, 2024 1:52 AM Ended: Jul 2, 2024 1:53 AM

Review all test suite changes for PR #4539 ↗︎

@galvana galvana requested a review from adamsachs June 26, 2024 18:37
Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

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

@galvana thanks for reviving this effort and addressing the main issues i'd flagged in the initial review! generally things look good with those.

i haven't tested this functionality myself manually, but i do want to make sure that we've done some recent manual testing on this, especially since it's been sitting dormant for a while, which makes it a bit more likely that some bugs would come up that slip underneath automated test coverage. have you been able to do some solid manual testing on the functionality?

the most important things i've flagged on this round are with the migration, i think. unless i'm missing something, i think those need to be resolved before we merge - and they generally tell me that we haven't tested the migration on a realistic DB state too much - so can we make sure that's well tested?

my other comments are relatively minor and should either be quick updates or are not must-haves.

let me know if you've got any questions or if i can lend a hand at all on the migration work!

@@ -169,19 +186,23 @@ async def workers_health() -> Dict:
},
},
)
async def health() -> Dict:
async def health(db: Session = Depends(get_db)) -> Dict:
Copy link
Contributor

Choose a reason for hiding this comment

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

k - so just to be sure, there was no functional requirement to have this included in the health check, i.e. nothing on the FE that was relying on this?

op.f("ix_fides_user_invite_id"), "fides_user_invite", ["id"], unique=False
)
op.add_column("fidesuser", sa.Column("email_address", CIText(), nullable=True))
op.add_column("fidesuser", sa.Column("disabled", sa.Boolean(), nullable=False))
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this need a default value and/or data migration to ensure that existing records have the value populated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I updated this to set disabled to False by default

@galvana galvana requested a review from adamsachs July 2, 2024 01:56
Copy link
Contributor

@adamsachs adamsachs 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 to me @galvana , thanks for this latest round of adjustments. let's ship it! 🚢

note: haven't reviewed the FE code, and didn't do manual testing myself. but assuming you've done that and trusting your discretion on the FE pieces - i'm good for this to be merged 👍

@galvana galvana dismissed eastandwestwind’s stale review July 2, 2024 15:19

Adam did a full re-review

@galvana galvana merged commit 281a981 into main Jul 2, 2024
47 of 48 checks passed
@galvana galvana deleted the invite-users-via-email branch July 2, 2024 15:26
Copy link

cypress bot commented Jul 2, 2024

Passing run #8668 ↗︎

0 4 0 0 Flakiness 0

Details:

Invite users via email (#4539)
Project: fides Commit: 281a981870
Status: Passed Duration: 00:42 💡
Started: Jul 2, 2024 3:37 PM Ended: Jul 2, 2024 3:38 PM

Review all test suite changes for PR #4539 ↗︎

@allisonking
Copy link
Contributor

party

andres-torres-marroquin pushed a commit that referenced this pull request Jul 2, 2024
Co-authored-by: Robert Keyser <[email protected]>
Co-authored-by: Allison King <[email protected]>
Co-authored-by: Allison King <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants