-
-
Notifications
You must be signed in to change notification settings - Fork 139
feat: prevent admin users from deleting their own accounts #321
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
base: master
Are you sure you want to change the base?
Conversation
Bundle ReportChanges will decrease total bundle size by 266.12kB (-13.18%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: manifestAssets Changed:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #321 +/- ##
=======================================
Coverage 85.27% 85.27%
=======================================
Files 57 57
Lines 1623 1623
Branches 373 364 -9
=======================================
Hits 1384 1384
- Misses 215 233 +18
+ Partials 24 6 -18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hello @Trighap52 thanks for your contribution. There is a conflict that has to be resolved. Can you check it ? Also we would need to add tests for this behavior. |
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.
See previous comment
38d190f
to
baef673
Compare
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.
Hello @Trighap52
Thank you for your changes, there is still an error in that code: it does not check that we are actually deleting ADMIN entity ! If I am logged as default admin with id 1 it will fail everytime I try to delete ANY item with ID 1.
Ensure that the "entity" param equals the admin slug (constants.ts) before.
Also be the "user.user" sounds a bit bad, maybe you can call it "requestUser.user", not perfect but sounds a bit better
@Trighap52 are you still working on this? If not, I’d be happy to pick it up and help move it forward |
@sahithvibudhi there is no news form @Trighap52 so you can take it from here if you want. Beware as the master branch changed quite a lot during that time, I suggest to start again from the last master version |
baef673
to
d8375a0
Compare
Description
This PR prevents an admin from deleting their own account while logged in. Previously, the admin could remove themselves from the app (from settings > admin) which resulted in a strange behavior. Now, a error is thrown if an admin tries to. I also updated the tests to correctly test the deletion (with a new mock and a new test case).
Related Issues
How can it be tested?
Try to delete yourself as an admin and an error shoul be thrown.

Check list before submitting
npx changeset