Spring-Boot-Blog-REST-API icon indicating copy to clipboard operation
Spring-Boot-Blog-REST-API copied to clipboard

Admin is not able to delete users

Open pravashupreti opened this issue 2 years ago • 4 comments

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:

  1. create user from admin role
  2. try to delete the user

Expected behavior Admin user shoud able to delete the user with user role

pravashupreti avatar Jun 12 '22 01:06 pravashupreti

Welcome @pravashupreti to Spring-Boot-Blog-REST-API community! Thanks so much for creating your first issue :)

github-actions[bot] avatar Jun 12 '22 01:06 github-actions[bot]

Can I fix it!?

vishalsrujansamanthige avatar Jun 12 '23 06:06 vishalsrujansamanthige

Hi @vishalsrujansamanthige, yes you can take it.

osopromadze avatar Jun 12 '23 08:06 osopromadze

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

zachary-berdell-elliott avatar Dec 23 '23 22:12 zachary-berdell-elliott