feat: restrict guest doctor access in clinic context by updating role-based routing and sidebar menu

This commit is contained in:
hamed
2026-06-19 21:08:32 +03:30
parent b686cd1e7d
commit 0624a08e62
5 changed files with 147 additions and 11 deletions
+1 -1
View File
@@ -297,7 +297,7 @@ Authorization: Bearer <token>
- context کلینیک که دکتر **صاحب** آن است: `"clinic"` (دسترسی کامل مالک)
- context منشی: `"secretary"`
> **نکته frontend:** پس از `switchContext`، `primaryRole` در store باید از `context.role` آپدیت شود.
> **نکته frontend:** پس از `switchContext`، `primaryRole` در store از `context.role` و `scope` از `context.scope` آپدیت می‌شود. وقتی `role:"doctor"` و `scope:"clinic"` است (پزشکِ مهمان)، Sidebar فقط «داشبورد» و «نوبت‌ها» را نشان می‌دهد و مسیرهای مدیریتی (`staff`, `clinic-services`, `subscription`, `my-secretaries`, `my-patients`, `profile`) به داشبورد ریدایرکت می‌شوند. در سمت backend هم endpointهای مدیریتی برای پزشک فقط scope **شخصیِ** خودش را برمی‌گردانند (نه کلینیک) و endpointهای ویرایش کلینیک مالکیت را چک می‌کنند (۴۰۳).
**قانون `db_uuid`**:
- اگر یک context وجود دارد: خودکار فعال می‌شود