-
Notifications
You must be signed in to change notification settings - Fork 1
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
add tests and handling for deleted users #953
base: 12-20-soft_delete_for_user_and_perms
Are you sure you want to change the base?
add tests and handling for deleted users #953
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Datadog ReportBranch report: ✅ 0 Failed, 249 Passed, 36 Skipped, 48.4s Total Time |
23cf858
to
e611093
Compare
describe("user.service", () => { | ||
beforeAll(async () => { | ||
await resetTables("User") | ||
await setUpWhitelist({ email: "@example.com" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this? don't see any logic within isUserDeleted
that's using the whitelisting table + believe this is handled by isEmailWhitelisted
?
// Setup active user | ||
await setupUser({ | ||
name: "Active User", | ||
userId: "active123", | ||
email: "active@example.com", | ||
phone: "12345678", | ||
isDeleted: false, | ||
}) | ||
|
||
// Setup deleted user | ||
await setupUser({ | ||
name: "Deleted User", | ||
userId: "deleted123", | ||
email: "deleted@example.com", | ||
phone: "12345678", | ||
isDeleted: true, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - might be better to move each of this into the respective test case in the "arrange" stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - do we want to make the non-essential fields (name, userId, phone) to fallback to a default value in setupUser
instead of having to specify them? doing so will make this setup cleaner and more readable since the "attention" will be on the isDeleted
arg
Problem
Deleted users were still able to access the system and view sites they previously had access to.
Closes ISOM-1701
Solution
Added checks to prevent deleted users from logging in and viewing sites they previously had access to.
Breaking Changes:
Features:
Improvements:
Tests
New scripts:
None
New dependencies:
None
New dev dependencies:
None