Spring-Boot-Blog-REST-API
Spring-Boot-Blog-REST-API copied to clipboard
Admin is not able to delete users
Describe the bug I tried to delete the user from admin role but not able to delete it.
To Reproduce Steps to reproduce the behavior:
- create user from admin role
- try to delete the user
Expected behavior Admin user shoud able to delete the user with user role
Welcome @pravashupreti to Spring-Boot-Blog-REST-API community! Thanks so much for creating your first issue :)
Can I fix it!?
Hi @vishalsrujansamanthige, yes you can take it.
I just spotted this issue and actually fixed this bug when I was adding test cases. This was due to an or || check that should have been an and && check. The exception was throw if the user was (not an admin OR not the current user). It should be thrown when the user was (not an admin AND not the current user). This is fixed in this PR if anyone finds this repository and wants to use it: https://github.com/osopromadze/Spring-Boot-Blog-REST-API/compare/main...zachary-berdell-elliott:Spring-Boot-Blog-REST-API-tests-added:feature/add-junit-tests?expand=1