Skip to content

[Fix] Role Change Logic for Super Admin and Other Roles #8703

Open
@rahul-rocket

Description

@rahul-rocket

Description:

Currently, the system allows users, including the Super Admin, to change their roles in ways that are not intended. Specifically:

  1. The Super Admin can change their role to a lower one even when no other Super Admin exists.
  2. 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:

  1. 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.
  1. 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.
  1. 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:

  1. Log in as a Super Admin.
  2. Attempt to change your role to a lower one when there are no other Super Admins.
  3. Log in as a user with a non-Super Admin role.
  4. Attempt to change your own role to a higher level, including Super Admin.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions