v1.0
Reference
Admin

DAC Academy — RBAC Matrix

1. ROLE DEFINITIONS

RoleConstantDescriptionTypical User
adminUSER_ROLE.ADMINFull system access. Manage users, settings, all data.Academy Director, Admin Staff
counselorUSER_ROLE.COUNSELORAdmissions & fee management. Cross-branch read access.Admission Counselor
wardenUSER_ROLE.WARDENHostel management. Scoped to assigned hostel.Hostel Warden
parentUSER_ROLE.PARENTSelf-service portal. Only own children's data.Parent/Guardian

2. COMPLETE PERMISSION MATRIX

2.1 Route-Level Permissions

Feature / RouteAdminCounselorWardenParent
Dashboard
/dashboard (Staff)✅ View✅ View✅ View❌
/parent/dashboard❌❌❌✅ View
Leads (CRM)
/leads (List)✅ View, Create, Edit✅ View, Create, Edit❌❌
/leads/new✅ Create✅ Create❌❌
/leads/[id]✅ View, Edit✅ View, Edit❌❌
Admissions
/admissions✅ View✅ View❌❌
/admissions/new✅ Create✅ Create❌❌
Students
/students✅ View✅ View✅ View (hostel only)❌
/students/[id]✅ View✅ View✅ View (hostel only)❌
/students/[id]/edit✅ Edit✅ Edit❌❌
Fees
/fees (Ledger)✅ View✅ View❌❌
Record/Edit/Void Payment✅✅❌❌
/manual-receipts✅ Create✅ Create❌❌
Hostel
/hostel✅ View❌✅ View❌
Medical Requests✅ View❌✅ View (scoped)❌
System
/users✅ Manage❌❌❌
/settings✅ Manage❌❌❌
/audit-log✅ View❌❌❌
/whatsapp-log✅ View❌❌❌
/announcements✅ Create/Edit/Delete❌❌❌
Parent Portal
Parent Dashboard❌❌❌✅ View
View Receipts❌❌❌✅ View (own)
Request/Cancel Outing❌❌❌✅ (own)
Medical Requests❌❌❌✅ (own)
Warden Portal
/warden/students✅❌✅❌
/warden/medical✅❌✅❌

2.2 Data Scoping Rules

OperationAdminCounselorWardenParent
Branch ScopeAll branchesAll branches (read); own branch (write)Own branch onlyN/A
Hostel ScopeAll hostelsN/AOwn hostel onlyN/A
Student ScopeAll studentsAll studentsHostel-opted onlyOwn children only

3. AUDIT EVENTS BY ROLE

Every state-changing action generates an audit log entry with before/after state snapshots.

ActionAdminCounselorWardenParent
Login/Logout✅✅✅✅
Lead Create/Status Change✅✅❌❌
Admission Submit✅✅❌❌
Student Update/Lifecycle✅✅❌❌
Fee Payment/Void✅✅❌❌
Outing Request❌❌❌✅
Outing Review✅❌✅❌
Medical Request/Acknowledge✅❌✅❌
Medical Complete/Reject✅❌✅❌
Announcement/Session/Setting✅❌❌❌

4. BRANCH SCOPING RULES

OperationAdminCounselorWarden
Read (list queries)All branchesAll branchesOwn branch only
Write (mutations)All branchesOwn branch onlyOwn hostel only

5. SPECIAL RBAC RULES

  1. Counselors have cross-branch READ access — can see all branches in lists, but write operations enforce their assigned branch
  2. Wardens derive branch from hostel — their branch is resolved from linked hostel, not from user record
  3. Parents can be staff — a user can simultaneously be a parent and have a staff role
  4. Admin can impersonate warden — can access all warden routes and see all hostels
  5. No role has DELETE permission — all deletions are soft deletes via isDeleted flag or voiding