Add Employee vs Client user type and filter time/reports by employee (#14) #15

Merged
westfarn merged 3 commits from feature/14-employee-client-user-type into master 2026-07-05 05:54:51 -07:00
Owner

Summary

  • Adds UserProfile model with mutually exclusive Employee / Client types
  • Replaces auto-Employee signal with auto-Client profile on user creation
  • Data migration: users with time log entries → Employee; others → Client (orphan Employee rows removed)
  • Admin UI at /financial/manage_users to set any user's type; profile page shows current type
  • Employees can log time; Clients get read-only access to reports and time logs
  • Time logs, reports, and dashboard filter to employees only
  • 14 new tests covering signals, type switching, access control, and filtering

Design decisions (from issue Q&A)

  1. Client login = read-only financial access (reports + time logs, no edit/log time)
  2. Employee and Client are strictly mutually exclusive
  3. Admins (superusers) can change type via Manage Users
  4. Bulk migration applied for existing users

Test plan

  • python manage.py test financial.tests (14 tests pass)
  • python manage.py test public.tests (21 tests pass)
  • Run migration on staging: python manage.py migrate
  • Verify admin can set user types at /financial/manage_users
  • Verify employee can log time at /financial/timekeeping
  • Verify client sees reports/time logs read-only, cannot log time
  • Verify employee filter dropdown excludes clients

Closes #14

## Summary - Adds `UserProfile` model with mutually exclusive **Employee** / **Client** types - Replaces auto-Employee signal with auto-Client profile on user creation - Data migration: users with time log entries → Employee; others → Client (orphan Employee rows removed) - Admin UI at `/financial/manage_users` to set any user's type; profile page shows current type - **Employees** can log time; **Clients** get read-only access to reports and time logs - Time logs, reports, and dashboard filter to employees only - 14 new tests covering signals, type switching, access control, and filtering ## Design decisions (from issue Q&A) 1. Client login = read-only financial access (reports + time logs, no edit/log time) 2. Employee and Client are strictly mutually exclusive 3. Admins (superusers) can change type via Manage Users 4. Bulk migration applied for existing users ## Test plan - [x] `python manage.py test financial.tests` (14 tests pass) - [x] `python manage.py test public.tests` (21 tests pass) - [ ] Run migration on staging: `python manage.py migrate` - [ ] Verify admin can set user types at `/financial/manage_users` - [ ] Verify employee can log time at `/financial/timekeeping` - [ ] Verify client sees reports/time logs read-only, cannot log time - [ ] Verify employee filter dropdown excludes clients Closes #14
westfarn added 1 commit 2026-07-05 05:51:30 -07:00
Closes #14. Users get a UserProfile (Employee or Client) instead of auto-creating Employee records; admins manage types via profile and manage-users UI; time entry and reports filter to employees only; clients get read-only financial access.
westfarn added 1 commit 2026-07-05 05:52:35 -07:00
Run unit tests on pull requests targeting master.
Deploy Company Site / test (pull_request) Successful in 18s
Deploy Company Site / deploy (pull_request) Has been skipped
42ae10e6fb
Keep deploy limited to pushes on master so PR CI validates changes without deploying.
westfarn added 1 commit 2026-07-05 05:54:00 -07:00
Split CI into unittests and deploy workflows.
Unit Tests / test (pull_request) Successful in 15s
560485ab16
Unit Tests runs on pull requests and master pushes; Deploy runs only after Unit Tests succeed on a master push.
westfarn merged commit 7dd5ec3be1 into master 2026-07-05 05:54:51 -07:00
westfarn deleted branch feature/14-employee-client-user-type 2026-07-05 05:54:51 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/company_site#15