Project

General

Profile

Actions

Bug #25

closed

Admin user can be created without role assignment (role is null)

Added by Vivek Kumar about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
03/19/2026
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

The system allows creation of an Admin user without assigning any role. When the role field is not provided in the request, the user is still successfully created with "role": null.
This leads to creation of incomplete user records and may impact role-based access control (RBAC) functionality.

Steps to Reproduce

  1. Send a POST request to: https://api.akinderwellness.com:4001/api/admin/add-admin
  2. In request body, provide:
  • email
  • password
  1. Do not include the role field
  2. Send the request

Actual Result
User is created successfully
API response:

{
    "success": true,
    "message": "Registered successfully",
    "res": {
        "userType": "Admin",
        "webToken": [],
        "fcmToken": [],
        "notification_weekly_report": false,
        "notification_password_change": false,
        "notification_all_activies": false,
        "notification_new_request": false,
        "notification_new_referral": false,
        "notification_new_message": false,
        "language": "en",
        "If_Deleted": false,
        "_id": "69bb9197190f06f44b128cb0",
        "email": "arbtestemailtemp@gmail.com",
        "role": null,
        "createdBy": "603c4a2f9644be25e93e1089",
        "password": "$2a$10$BK1d/hK.JPKiyUDmqDyYO.YQAA.CJkj4set4R8QYt4XCPefhgNBSC",
        "secondary_password": null,
        "createdAt": "2026-03-19T06:03:03.946Z",
        "__v": 0
    }
}

Expected Result

  • System should not allow user creation without a role
  • API should return validation error such as: "Role is required" or System should assign a default role automatically

Files

BUG AKW0014.png (322 KB) BUG AKW0014.png The username selected in blue has no role assigned Vivek Kumar, 03/19/2026 06:28 AM

Related issues 1 (0 open1 closed)

Related to Bug #27: API accepts arbitrary role IDs during admin creation.Closed03/20/2026

Actions
Actions

Also available in: Atom PDF