Files
leocrm/alembic/versions/0115_drop_redundant_db_roles.py
Agent Zero 0eb6d7621e
Check Cross-Plugin Imports / check (push) Has been cancelled
fix(security): 16 mittlere Probleme behoben (P18-P33)
P18: require_permission zu forgejo_error_reporter und ai_ui_control routes hinzugefügt
P19: Cross-Tenant Permission-Cache-Invalidierung bei Rollenänderungen
P20: Session/Permission-Cache-Invalidierung bei Gruppen-Änderungen
P21: ENTITY_MODELS Registry um fehlende Plugin-Modelle erweitert
P22: Entity-Links prüfen verknüpfte Entity-Permissions
P23: authStore persist Middleware entfernt (kein localStorage mehr)
P24: 5xx Retry nur noch für GET-Requests
P25: KI-Kommentar in address.py (bekannte Inkonsistenz)
P26: DeletionLog in EntityHistory gemerged (action=delete)
P27: KI-Kommentar in entity_policy.py (ABAC nicht aktiv genutzt)
P28: db.commit() aus bulk_permission_service entfernt
P29: CSV-Export in export_service.py ausgelagert
P30: plugins.py Business-Logik in plugin_install_service.py ausgelagert
P31: KI-Kommentar in session.py (Dual-System dokumentiert)
P32: Migration 0115: crm_platform_admin Role droppen
P33: Cross-Plugin Imports über contracts.py behoben (10 Violations → 0)
2026-08-06 13:23:58 +02:00

37 lines
941 B
Python

"""Drop redundant DB roles (crm_platform_admin).
crm_runtime was already dropped in migration 0085.
crm_platform_admin was created in 0085 for one-time infrastructure use
and is no longer needed.
Revision ID: 0115
Revises: 0114
"""
from alembic import op
revision = "0115"
down_revision = "0114"
branch_labels = None
depends_on = None
def upgrade() -> None:
# Drop crm_platform_admin if it exists
op.execute(
"DO $$ BEGIN "
"DROP ROLE IF EXISTS crm_platform_admin; "
"EXCEPTION WHEN insufficient_privilege THEN NULL; "
"WHEN dependent_objects_still_exist THEN NULL; "
"END $$;"
)
def downgrade() -> None:
# Recreate crm_platform_admin (for rollback)
op.execute(
"DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'crm_platform_admin') THEN "
"CREATE ROLE crm_platform_admin NOSUPERUSER NOBYPASSRLS NOLOGIN; "
"END IF; END $$;"
)