NexGenStudioDev/ciitm-frontend
Create Page for Admin Role Assignment & Access Control
Open
#204 opened on Aug 14, 2025
Ciitm FrontendReactResponsiveUi Updatebest-practicesenhancementfeature-requestgood first issuehacktoberfesthelp wantedonlydust-wave
Repository metrics
- Stars
- (9 stars)
- PR merge metrics
- (PR metrics pending)
Description
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.