|
| 1 | +# RBAC Specification – HMS Backend |
| 2 | + |
| 3 | +This document defines the Role-Based Access Control (RBAC) model for the HMS Backend system. |
| 4 | + |
| 5 | +The objective of this specification is to clearly define: |
| 6 | + |
| 7 | +* System modules |
| 8 | +* Allowed actions per module |
| 9 | +* Access boundaries per role |
| 10 | +* Enforcement expectations at middleware level |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +# 1. Roles |
| 15 | + |
| 16 | +The system currently supports the following roles: |
| 17 | + |
| 18 | +* **Admin** |
| 19 | +* **Doctor** |
| 20 | +* **Reception** |
| 21 | +* **Billing Staff** |
| 22 | + |
| 23 | +Each role has defined authority boundaries to ensure operational control and data protection. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +# 2. System Modules |
| 28 | + |
| 29 | +The backend exposes the following logical modules: |
| 30 | + |
| 31 | +1. Dashboard |
| 32 | +2. Doctor Management |
| 33 | +3. Patient Management |
| 34 | +4. Department Management |
| 35 | +5. Schedule Management |
| 36 | +6. Appointment Management |
| 37 | +7. Billing / Payment |
| 38 | +8. Reports |
| 39 | +9. Human Resources |
| 40 | +10. System Settings & Security |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +# 3. Action Definitions |
| 45 | + |
| 46 | +Standard action types used across modules: |
| 47 | + |
| 48 | +* **View** – Read access |
| 49 | +* **Create** – Add new records |
| 50 | +* **Update** – Modify existing records |
| 51 | +* **Delete** – Remove records |
| 52 | +* **Approve** – Authorize specific actions (if applicable) |
| 53 | +* **Export** – Generate downloadable data |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +# 4. Role Permission Matrix |
| 58 | + |
| 59 | +## 4.1 Admin |
| 60 | + |
| 61 | +Administrative superuser with full system authority. |
| 62 | + |
| 63 | +Permissions: |
| 64 | + |
| 65 | +* Full access (View / Create / Update / Delete) across all modules |
| 66 | +* Manage user roles and permissions |
| 67 | +* Access system configuration and security settings |
| 68 | +* View and export all reports |
| 69 | +* Manage HR records |
| 70 | +* Verify and review billing/payment records |
| 71 | + |
| 72 | +Admin has unrestricted operational and configuration-level control. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## 4.2 Doctor |
| 77 | + |
| 78 | +Clinical authority with access restricted to assigned operational data. |
| 79 | + |
| 80 | +Permissions: |
| 81 | + |
| 82 | +Dashboard: |
| 83 | + |
| 84 | +* View personal dashboard |
| 85 | + |
| 86 | +Patient Management: |
| 87 | + |
| 88 | +* View assigned patients |
| 89 | +* Update consultation notes |
| 90 | +* Cannot delete patient records |
| 91 | +* Cannot create new patient profiles (unless explicitly allowed) |
| 92 | + |
| 93 | +Appointment Management: |
| 94 | + |
| 95 | +* View assigned appointments |
| 96 | +* Update appointment status (e.g., Completed, Cancelled) |
| 97 | + |
| 98 | +Schedule: |
| 99 | + |
| 100 | +* View own schedule |
| 101 | + |
| 102 | +Reports: |
| 103 | + |
| 104 | +* View reports related to own patients |
| 105 | +* Cannot access system-wide financial reports |
| 106 | + |
| 107 | +Restrictions: |
| 108 | + |
| 109 | +* No access to HR module |
| 110 | +* No access to system settings |
| 111 | +* No authority to manage other doctors |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 4.3 Reception |
| 116 | + |
| 117 | +Front-desk workflow management role. |
| 118 | + |
| 119 | +Permissions: |
| 120 | + |
| 121 | +Patient Management: |
| 122 | + |
| 123 | +* Create patient registration |
| 124 | +* Update patient demographic details |
| 125 | +* View patient records |
| 126 | +* Cannot delete patient records |
| 127 | + |
| 128 | +Appointment Management: |
| 129 | + |
| 130 | +* Create appointments |
| 131 | +* Assign doctors |
| 132 | +* Update appointment details |
| 133 | +* Cancel appointments |
| 134 | + |
| 135 | +Schedule: |
| 136 | + |
| 137 | +* View and manage available slots |
| 138 | + |
| 139 | +Billing: |
| 140 | + |
| 141 | +* Create initial billing entries |
| 142 | +* View payment status |
| 143 | +* Cannot finalize or override billing records (if Billing Staff exists) |
| 144 | + |
| 145 | +Reports: |
| 146 | + |
| 147 | +* View basic operational reports |
| 148 | + |
| 149 | +Restrictions: |
| 150 | + |
| 151 | +* No access to HR |
| 152 | +* No access to system configuration |
| 153 | +* No access to medical consultation notes editing |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +## 4.4 Billing Staff |
| 158 | + |
| 159 | +Financial operations authority. |
| 160 | + |
| 161 | +Permissions: |
| 162 | + |
| 163 | +Billing: |
| 164 | + |
| 165 | +* Create billing records |
| 166 | +* Update billing records |
| 167 | +* Mark payment status |
| 168 | +* Generate invoices |
| 169 | +* Export billing reports |
| 170 | + |
| 171 | +Patient Management: |
| 172 | + |
| 173 | +* View patient billing-related data |
| 174 | +* Cannot modify medical or demographic information |
| 175 | + |
| 176 | +Reports: |
| 177 | + |
| 178 | +* View and export financial reports |
| 179 | + |
| 180 | +Restrictions: |
| 181 | + |
| 182 | +* No access to HR |
| 183 | +* No access to system settings |
| 184 | +* No access to medical consultation editing |
| 185 | + |
| 186 | +--- |
| 187 | + |
| 188 | +# 5. Consolidated Permission Matrix |
| 189 | + |
| 190 | +| Module | Admin | Doctor | Reception | Billing Staff | |
| 191 | +| ------------------- | ----- | --------------- | --------------- | ------------------- | |
| 192 | +| Dashboard | Full | Own | Limited | Limited | |
| 193 | +| Doctor Management | CRUD | Self | View | No Access | |
| 194 | +| Patient Management | CRUD | View Assigned | Create / Update | View (Billing Only) | |
| 195 | +| Appointment | CRUD | Update Assigned | Create / Update | View | |
| 196 | +| Schedule | CRUD | View Own | Manage Slots | No Access | |
| 197 | +| Billing | Full | View | Create | CRUD | |
| 198 | +| Reports | Full | Own Patients | Operational | Financial Only | |
| 199 | +| Human Resources | CRUD | No Access | No Access | No Access | |
| 200 | +| Settings & Security | Full | No Access | No Access | No Access | |
| 201 | + |
| 202 | +Legend: |
| 203 | + |
| 204 | +* **Full / CRUD** = View, Create, Update, Delete |
| 205 | +* **Own** = Limited to assigned records |
| 206 | +* **Limited** = Restricted data view |
| 207 | +* **No Access** = Access denied |
| 208 | + |
| 209 | +--- |
| 210 | + |
| 211 | +# 6. Enforcement Strategy |
| 212 | + |
| 213 | +RBAC enforcement must occur at: |
| 214 | + |
| 215 | +* Middleware level (route protection) |
| 216 | +* Service-level ownership validation (e.g., doctor accessing only assigned patients) |
| 217 | + |
| 218 | +Example enforcement layers: |
| 219 | + |
| 220 | +1. Authentication middleware (JWT verification) |
| 221 | +2. Role validation middleware |
| 222 | +3. Resource ownership validation inside services |
| 223 | + |
| 224 | +Security must not rely solely on frontend role checks. |
| 225 | + |
| 226 | +--- |
| 227 | + |
| 228 | +# 7. Future Expansion |
| 229 | + |
| 230 | +The RBAC model is designed to support: |
| 231 | + |
| 232 | +* Fine-grained permission mapping (role → permissions table) |
| 233 | +* Permission-based system instead of hardcoded roles |
| 234 | +* Audit logging per action |
| 235 | +* Multi-hospital tenant architecture (if required) |
| 236 | + |
| 237 | +--- |
| 238 | + |
| 239 | +# 8. Design Principles |
| 240 | + |
| 241 | +* Least privilege access |
| 242 | +* Clear authority boundaries |
| 243 | +* Separation between operational and financial control |
| 244 | +* Role enforcement independent of UI |
| 245 | + |
| 246 | +--- |
| 247 | + |
| 248 | +This document serves as the official access contract between backend and frontend teams. |
| 249 | + |
| 250 | +All new features must align with this specification unless formally updated. |
| 251 | + |
| 252 | +--- |
| 253 | + |
0 commit comments