Add firm admin dashboard and workspace switcher
This commit is contained in:
+18
-22
@@ -117,35 +117,32 @@ def _post_login_redirect(must_change_password: bool, permissions: set[str], role
|
||||
if must_change_password:
|
||||
return "/change-password-required"
|
||||
|
||||
if "Client" in roles:
|
||||
return "/client/dashboard"
|
||||
|
||||
if "Consultant" in roles:
|
||||
return "/consultant/dashboard"
|
||||
|
||||
role_set = set(roles or [])
|
||||
|
||||
# System Admin must land on platform dashboard before employee/self-service routing.
|
||||
# Platform owner always lands on platform control centre first.
|
||||
if "System Admin" in role_set:
|
||||
return "/system-admin/dashboard"
|
||||
|
||||
# Phase 7K refinement:
|
||||
# Dedicated Partner users should land directly on Partner Workspace.
|
||||
# System/Firm Admin users are not forced here because they keep broader admin context.
|
||||
if "Partner" in role_set and not role_set.intersection({"System Admin", "Firm Admin"}):
|
||||
if "Client" in role_set:
|
||||
return "/client/dashboard"
|
||||
|
||||
if "Consultant" in role_set:
|
||||
return "/consultant/dashboard"
|
||||
|
||||
# If Firm Admin is also Partner, daily operations are more frequent;
|
||||
# the workspace switcher exposes Firm Administration when required.
|
||||
if "Firm Admin" in role_set and "Partner" in role_set:
|
||||
return "/partner/dashboard"
|
||||
|
||||
# Phase 7J refinement:
|
||||
# Dedicated manager users should land directly on Manager Workspace.
|
||||
# Higher management roles are intentionally not redirected here because
|
||||
# they may later get their own Firm Admin dashboards.
|
||||
if role_set.intersection({"Manager", "Branch Manager"}) and not role_set.intersection({"System Admin", "Firm Admin", "Partner"}):
|
||||
if "Firm Admin" in role_set:
|
||||
return "/firm-admin/dashboard"
|
||||
|
||||
if "Partner" in role_set:
|
||||
return "/partner/dashboard"
|
||||
|
||||
if role_set.intersection({"Manager", "Branch Manager"}):
|
||||
return "/manager/dashboard"
|
||||
|
||||
# Phase 7I refinement:
|
||||
# For internal firm users, make My Workspace the default landing page.
|
||||
# This keeps Client/Consultant portal routing unchanged and only falls back
|
||||
# to System Settings where the login has no employee/self-service access.
|
||||
if (
|
||||
"employees.ess.view" in permissions
|
||||
or "employees.work.view_self" in permissions
|
||||
@@ -153,7 +150,7 @@ def _post_login_redirect(must_change_password: bool, permissions: set[str], role
|
||||
or "employees.leave.view_self" in permissions
|
||||
or "employees.documents.view_self" in permissions
|
||||
or "employees.payroll.view_self" in permissions
|
||||
or {"System Admin", "Firm Admin", "Partner", "Staff"}.intersection(role_set)
|
||||
or "Staff" in role_set
|
||||
):
|
||||
return "/employee/dashboard"
|
||||
|
||||
@@ -162,7 +159,6 @@ def _post_login_redirect(must_change_password: bool, permissions: set[str], role
|
||||
|
||||
return "/employee/dashboard"
|
||||
|
||||
|
||||
def _is_user_login_allowed(user: User) -> tuple[bool, str | None]:
|
||||
if not user:
|
||||
return False, "Invalid credentials"
|
||||
|
||||
Reference in New Issue
Block a user