admin

Please wait...

Adding New Roles to MediDash

person_add_alt_1 Adding a New Role to MediDash

MediDash is designed for extensibility, allowing you to easily add new roles beyond the built-in Admin, Doctor, and Patient roles. This guide provides a comprehensive walkthrough of the process, with best practices and code examples to help you along the way.

lightbulb
Prerequisite: Before adding a new role, it's important to have a clear understanding of the role's responsibilities and the level of access it requires within your healthcare system.

integration_instructions Implementation Steps

Follow these six essential steps to successfully integrate a new role into your MediDash application:

looks_one Step 1: Define the New Role

The first step is to define the new role in the Role enum, which is located in the core models directory.

File Location
src/app/core/models/role.ts
Example

export enum Role {
  Admin = 'ADMIN',
  Doctor = 'DOCTOR',
  Patient = 'PATIENT',
  // Add your new role here
  Pharmacist = 'PHARMACIST'
}

                                                            
Best Practices
  • thumb_upUse uppercase for consistency.
  • thumb_upChoose a descriptive and meaningful name.
  • thumb_upKeep the list in alphabetical order.
looks_two Step 2: Add Sample User Data

For testing and development purposes, create a sample user entry in the users.json file.

File Location
src/assets/data/users.json
Example

{
  "id": 4,
  "username": "pharmacist@example.com",
  "password": "pharmacist123",
  "firstName": "John",
  "lastName": "Doe",
  "token": "fake-pharmacist-token",
  "role": "PHARMACIST",
  "img": "assets/images/users/pharmacist.png"
}

                                                            
Security Note
  • warningThis is for development purposes only.
  • warningIn a production environment, use a secure database.
  • warningAlways hash passwords in production.