03 — Role-Based Workspace and View Resolution
Objective
Resolve the Work section from the user's onboarding assignment and expose every applicable existing department view.
Resolution inputs
Organization
× Workspace
× Department
× Department role
× Industry
× Permissions
× Tenant configuration
Assignment model
export interface DemoUserAssignment {
userId: string;
name: string;
organizationRole: string;
workspaceId: string;
department: DepartmentKey;
departmentRole: string;
industry: IndustryKey;
permissions: string[];
defaultView: string;
}
View registry
export interface DepartmentViewDefinition {
id: string;
label: string;
route: string;
component: React.ComponentType;
icon?: React.ComponentType;
requiredPermissions?: string[];
industries?: string[];
}
export interface DepartmentWorkspaceDefinition {
department: DepartmentKey;
label: string;
defaultView: string;
views: DepartmentViewDefinition[];
}
Resolution algorithm
- Read the current user's assignment.
- Resolve the assigned department registry.
- Include every registered view matching industry and tenant configuration.
- Remove views blocked by permissions.
- Add authorized cross-functional views.
- Resolve the default view.
- Render the complete result under Work.
The frontend must not hard-code one generic department lens.
Account Success rule
All valid views found under:
apps/web/src/components/l1/domains/account-success/views
must be inventoried and registered. If ten valid views exist, the assigned Account Success user must receive ten Work entries unless a permission explicitly removes one.
Other departments
Apply the same rule to every domain folder under:
apps/web/src/components/l1/domains/*/views
Potential domains include Sales, Account Success, Support, Finance, Operations, Marketing, Product, Engineering, HR, Legal, Procurement, and Executive. The actual list must come from the repository.
Workspace and role switching
The sidebar switcher must show:
- Organization
- Workspace
- Department
- Department role
- Available demo personas
Switching must update locally without a page reload:
- Work navigation
- Default route
- Home content
- Queue items
- Approval items
- Available Platform modules
- Contextual Twin suggestions
Required demo personas
At minimum:
- Aisha — Account Success Manager
- Daniel — Finance Manager
- Maya — Operations Lead
- Arjun — Platform Administrator
Each persona must produce visibly different navigation and work content.
Route convention
/app/work/:department/:view
Examples:
/app/work/account-success/portfolio
/app/work/account-success/renewals
/app/work/finance/collections
/app/work/operations/queue
Acceptance criteria
- Onboarding saves a local role and department assignment.
- Work navigation is generated from the registry.
- Every valid Account Success view is visible to the Account Success persona.
- Other department views are resolved from existing component folders.
- Permission filtering works before rendering.
- Role switching updates routes, navigation, content, and Twin signals locally.