Skip to content

Create Page for Admin Role Assignment & Access ControlΒ #204

@abhishek-nexgen-dev

Description

@abhishek-nexgen-dev

The Admin Role Management page includes the following functionality:

  • βœ… Assign Admin role to other users by entering their email.
  • πŸ“„ View a list of all users who currently have the Admin role (including their name and email).
  • ❌ Revoke Admin access from other Admin users (excluding self, ideally).

This feature ensures only trusted users can manage administrative privileges, enhancing overall security and control within the application.


🎯 Objectives

  • βœ… Assign Admin role to a user by email.
  • πŸ“„ Display a list of all current Admin users.
  • ❌ Allow Admins to delete/revoke another Admin’s access.

πŸ” Access Control

  • This page is restricted to authenticated users with the Admin role.
  • If a non-admin user attempts to access the page:
    • They should be redirected to a safe route (e.g., dashboard or homepage), or
    • They should see an "Access Denied" message.

πŸ”— API Integration

πŸ”Έ 1. Assign Admin Role

  • Endpoint: POST /api/v1/role/create

Payload:

{
  "email": "user@example.com"
}

πŸ”Ή 2. Get All Admins

  • (Assumed endpoint): GET /api/v1/role/admins
  • Response Example:
[
  {
    "name": "John Doe",
    "email": "john@example.com",
    "role": "admin"
  },
  ...
]

πŸ”» 3. Delete Admin Role

  • (Assumed endpoint): DELETE /api/v1/role/admin/:email
  • Params: Admin email to revoke access from
  • ❗ Make sure backend prevents an admin from deleting their own role unless intended.

Issue Number

NexGenStudioDev/Ciitm-Backend#59

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions