{"slug":"developers/03_ROLE_BASED_WORKSPACE_AND_VIEW_RESOLUTION","title":"03 — Role-Based Workspace and View Resolution","section":"developers","sectionLabel":"Developers","status":"unclassified","type":"document","path":"developers/03_ROLE_BASED_WORKSPACE_AND_VIEW_RESOLUTION.mdx","bytes":3254,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n## Objective\n\nResolve the Work section from the user's onboarding assignment and expose every applicable existing department view.\n\n## Resolution inputs\n\n```text\nOrganization\n× Workspace\n× Department\n× Department role\n× Industry\n× Permissions\n× Tenant configuration\n```\n\n## Assignment model\n\n```ts\nexport interface DemoUserAssignment {\n  userId: string;\n  name: string;\n  organizationRole: string;\n  workspaceId: string;\n  department: DepartmentKey;\n  departmentRole: string;\n  industry: IndustryKey;\n  permissions: string[];\n  defaultView: string;\n}\n```\n\n## View registry\n\n```ts\nexport interface DepartmentViewDefinition {\n  id: string;\n  label: string;\n  route: string;\n  component: React.ComponentType;\n  icon?: React.ComponentType;\n  requiredPermissions?: string[];\n  industries?: string[];\n}\n\nexport interface DepartmentWorkspaceDefinition {\n  department: DepartmentKey;\n  label: string;\n  defaultView: string;\n  views: DepartmentViewDefinition[];\n}\n```\n\n## Resolution algorithm\n\n1. Read the current user's assignment.\n2. Resolve the assigned department registry.\n3. Include every registered view matching industry and tenant configuration.\n4. Remove views blocked by permissions.\n5. Add authorized cross-functional views.\n6. Resolve the default view.\n7. Render the complete result under Work.\n\nThe frontend must not hard-code one generic department lens.\n\n## Account Success rule\n\nAll valid views found under:\n\n```text\napps/web/src/components/l1/domains/account-success/views\n```\n\nmust 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.\n\n## Other departments\n\nApply the same rule to every domain folder under:\n\n```text\napps/web/src/components/l1/domains/*/views\n```\n\nPotential domains include Sales, Account Success, Support, Finance, Operations, Marketing, Product, Engineering, HR, Legal, Procurement, and Executive. The actual list must come from the repository.\n\n## Workspace and role switching\n\nThe sidebar switcher must show:\n\n- Organization\n- Workspace\n- Department\n- Department role\n- Available demo personas\n\nSwitching must update locally without a page reload:\n\n- Work navigation\n- Default route\n- Home content\n- Queue items\n- Approval items\n- Available Platform modules\n- Contextual Twin suggestions\n\n## Required demo personas\n\nAt minimum:\n\n- Aisha — Account Success Manager\n- Daniel — Finance Manager\n- Maya — Operations Lead\n- Arjun — Platform Administrator\n\nEach persona must produce visibly different navigation and work content.\n\n## Route convention\n\n```text\n/app/work/:department/:view\n```\n\nExamples:\n\n```text\n/app/work/account-success/portfolio\n/app/work/account-success/renewals\n/app/work/finance/collections\n/app/work/operations/queue\n```\n\n## Acceptance criteria\n\n- Onboarding saves a local role and department assignment.\n- Work navigation is generated from the registry.\n- Every valid Account Success view is visible to the Account Success persona.\n- Other department views are resolved from existing component folders.\n- Permission filtering works before rendering.\n- Role switching updates routes, navigation, content, and Twin signals locally.\n"}