Skip to content

Add Roles/Permissions to Tickets & Default Organization Layer With Chart#190

Merged
mfisher31 merged 21 commits into
mieweb:mainfrom
mfisher31:roles-permissions-org
May 19, 2026
Merged

Add Roles/Permissions to Tickets & Default Organization Layer With Chart#190
mfisher31 merged 21 commits into
mieweb:mainfrom
mfisher31:roles-permissions-org

Conversation

@mfisher31
Copy link
Copy Markdown
Collaborator

Introduces a default Organization layer for higher level operations in the system. Is easily expandable to a multi-org system. Along with this comes a Roles/Permissions system using CASL. Tickets have been converted to use CASL abilities

Closes #151
Closes #132

mfisher31 added 15 commits May 14, 2026 22:48
- Add reportsToUserId field to OrganizationAdminUser interface
- Create /v1/org/users/:userId endpoint to update reportsToUserId
- Add Reports To dropdown to OrganizationMembersPage with None option
- Update backend GET /admin/organization/users to fetch reportsToUserId
- Make dropdowns fill entire table cell width with flex-1 class
- Support null values for clearing the Reports To field
- Add OrganizationPage: full-viewport org chart display based on reportsTo
- Add OrganizationChart: YChartEditor-based org structure visualization
- Add Organization link to Manage sidebar section with faSitemap icon
- Register /app/organization route in AppLayout
- Add seed-hierarchy.ts: deterministic multi-level manager structure for seeded users
- Add seed-org-hierarchy.ts: standalone script to reapply hierarchy without full reseed
- Wire hierarchy seeding into standard seed flow (npm run seed)
- Add npm run seed:hierarchy command for hierarchy-only updates
…esh, cmdk entry

- Replace ychart built-in info panel with a centered modal showing Name,
  @handle, and a View Profile link (patches showNodeDetails on the instance)
- Add username field to OrganizationChartMember and pass it through from
  OrganizationPage so the handle is available in the modal
- Move Members/Refresh control from top to bottom-right of the chart canvas
- Add Org Chart entry to the command palette (Manage group, faSitemap icon)
- Override --yc-color-success and --yc-shadow-node-selected in ychart-dark.css
  to use the brand primary color instead of the hardcoded Material Blue (#2196F3)
  that was conflicting with the orange brand on node selection and canvas focus
- Add public /v1/organization and /v1/organization/users backend endpoints
  accessible to any authenticated user (not admin-only)
- Add orgApi client in src/lib/api.ts for the new public endpoints
- Update OrganizationPage to use orgApi instead of admin API
- Hide ychart UI chrome (field selector, YAML editor, toggle/filter
  buttons, POI selector wrapper) via injected CSS in OrganizationChart
- Fix unused import lint errors in OrganizationPage and ProfilePage
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a default organization layer, CASL-based ticket authorization, organization/admin UI surfaces, and org chart functionality across the backend and React app.

Changes:

  • Adds organization models, migration/config, APIs, roles/permissions, and ticket authorization changes.
  • Adds organization chart/member management UI and profile work-summary reuse.
  • Updates CI/deploy migration execution and expands ticket permission tests.

Reviewed changes

Copilot reviewed 47 out of 48 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/ui/UserDropdown.tsx Adds team switching and org member navigation.
src/ui/Sidebar.tsx Adds organization navigation.
src/ui/SettingsPage.tsx Adds organization admin settings.
src/ui/CommandPalette.tsx Adds org chart command.
src/ui/AppPage.tsx Adds no-padding layout option.
src/ui/AppLayout.tsx Registers organization routes.
src/ui/AppHeader.tsx Removes header team selector.
src/lib/organizationAccess.ts Adds org admin access helpers.
src/lib/api.ts Adds org/admin API clients and types.
src/features/teams/ychart-dark.css Aligns ychart brand colors.
src/features/teams/TeamsPage.tsx Removes chart/timesheet tab content from teams page.
src/features/profile/WorkSummaryTags.tsx Extracts recent work tags.
src/features/profile/useProfileTickets.ts Extracts profile ticket-fetching hook.
src/features/profile/ProfileWorkSnapshot.tsx Reuses profile ticket hook.
src/features/profile/ProfilePage.tsx Uses extracted work summary component.
src/features/profile/CompactTicketList.tsx Adds compact ticket display.
src/features/org/TeamMembersView.tsx Adds team-member fallback view.
src/features/org/OrganizationPage.tsx Adds organization chart page.
src/features/org/OrganizationOverviewPage.tsx Adds org admin overview.
src/features/org/OrganizationMembersPage.tsx Adds org member/role/reporting management.
src/features/org/OrganizationChart.tsx Adds ychart-based organization chart/lightbox.
src/features/clock/TimesheetRow.tsx Adjusts multi-day row/status/action behavior.
src/features/admin/AdminUsersPage.tsx Adds admin users page implementation.
package-lock.json Adds CASL dependencies.
backend/tests/tickets.test.ts Updates ticket authorization expectations/tests.
backend/tests/migrations.test.ts Removes migration test suite.
backend/src/services/timer.service.ts Adds invalid-date timer start result.
backend/src/services/ticket.service.ts Applies CASL ticket permissions.
backend/src/services/team.service.ts Creates/defaults organization for teams.
backend/src/server.ts Registers org routes.
backend/src/routes/users.ts Adds org/session/admin user endpoints.
backend/src/routes/timers.ts Maps invalid-date timer errors.
backend/src/routes/tickets.ts Uses authorization helpers in ticket routes.
backend/src/routes/org.ts Adds reports-to update endpoint.
backend/src/models/team.model.ts Adds orgId to teams.
backend/src/models/organization.model.ts Adds organization model.
backend/src/models/index.ts Adds organization collection accessor.
backend/src/lib/permissions.ts Adds CASL ability builder.
backend/src/lib/org-config.ts Adds default org config.
backend/scripts/seed.ts Expands seed users/teams and hierarchy setup.
backend/scripts/seed-org-hierarchy.ts Adds hierarchy seed script.
backend/scripts/seed-hierarchy.ts Adds seeded reporting structure.
backend/README.md Documents default org env vars.
backend/package.json Adds CASL deps and hierarchy seed script.
backend/migrations/20260514_120000_add-organizations-and-team-org-id.cjs Adds org/team backfill migration.
backend/.github/workflows/deploy-backend.yml Runs backend migrations during deploy.
.github/workflows/ci.yml Runs backend migrations during deploy jobs.
.github/copilot-instructions.md Adds permission-change guidance.
Comments suppressed due to low confidence (1)

backend/tests/migrations.test.ts:1

  • This removes the migration test suite without adding replacement coverage, while the PR adds a new data migration that backfills organization IDs. Keeping migration tests is important here because a broken migration would block deploys now that deploy workflows run npm run migrate; add coverage for the new org/team backfill instead of deleting the suite.

Comment thread backend/src/routes/users.ts
Comment thread backend/src/routes/org.ts Outdated
Comment thread backend/migrations/20260514_120000_add-organizations-and-team-org-id.cjs Outdated
Comment thread src/features/profile/WorkSummaryTags.tsx
Comment thread src/features/org/OrganizationChart.tsx
Comment thread src/ui/CommandPalette.tsx
Comment thread backend/src/routes/users.ts
Comment thread backend/src/routes/org.ts Outdated
Comment thread backend/src/services/team.service.ts
Comment thread src/features/admin/AdminUsersPage.tsx Outdated
mfisher31 and others added 3 commits May 19, 2026 06:32
@mfisher31 mfisher31 force-pushed the roles-permissions-org branch from 64781c7 to 5ebd617 Compare May 19, 2026 13:50
@mfisher31 mfisher31 merged commit ab3d14d into mieweb:main May 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Role/Team-Based Permissions Add Minimal Org Layer to Data Model Early

2 participants