modcomms/backend/alembic/versions
michael d21036a0de Add 4-tier RBAC backend: auth dependencies, role enforcement, agency filtering
- Add CHECK constraint migration for users.role (super_admin, oversight_admin, agency_admin, basic_user)
- Add get_current_db_user dependency resolving Azure claims to User ORM with agency
- Add require_role() factory and require_write_access() dependency
- Auto-promote dev user to super_admin when DISABLE_AUTH=true
- Add /api/me, PUT /api/users/{id}, POST /api/agencies endpoints
- Apply agency-based data filtering on campaigns, analytics, audit routes
- Block oversight_admin from all mutation routes (campaigns, proofs, flags, resolves)
- Restrict dropdown option mutations to super_admin only
- Add role check in WebSocket handler to block oversight_admin from analysis
- Add CurrentUserResponse, UserUpdate, AgencyCreate schemas

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 08:28:23 -06:00
..
001_initial_schema.py permissions changes 2025-12-18 16:51:27 +00:00
002_seed_dropdown_options.py Seed database with agencies, brand guidelines, and dropdown options 2025-12-18 17:16:23 -06:00
003_add_meta_proof_types.py Add proof types for Meta sub-channel 2026-01-08 10:07:28 -06:00
004_cleanup_duplicate_dropdown_options.py Add migration to cleanup duplicate dropdown options 2026-01-23 13:22:44 -06:00
005_add_file_hash.py Fix migration down_revision to correct revision ID 2026-01-25 10:18:11 -06:00
006_add_knowledge_base.py Add Knowledge Base management system for AI agent specs 2026-02-12 15:00:36 -06:00
007_add_role_check_constraint.py Add 4-tier RBAC backend: auth dependencies, role enforcement, agency filtering 2026-02-19 08:28:23 -06:00