Open
Description
Description:
Currently, the system allows users, including the Super Admin, to change their roles in ways that are not intended. Specifically:
- The Super Admin can change their role to a lower one even when no other Super Admin exists.
- Users can increase their own roles to higher levels, including Super Admin.
These issues need to be addressed to ensure role management adheres to the intended logic.
Acceptance Criteria:
- Super Admin Role Changes:
- A Super Admin can only change their role to a lower one if there is at least one other Super Admin in the database.
- If the above condition is not met, the role change should be disallowed, and the user should be notified with an appropriate message.
- Promoting Users to Super Admin:
- Only an existing Super Admin can promote another user to the Super Admin role.
- A user cannot promote themselves to Super Admin under any circumstances.
- Self-Role Changes:
- No user, except a Super Admin under the condition mentioned above, should be able to change their own role to a higher level.
Steps to Reproduce:
- Log in as a Super Admin.
- Attempt to change your role to a lower one when there are no other Super Admins.
- Log in as a user with a non-Super Admin role.
- Attempt to change your own role to a higher level, including Super Admin.