This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- ===================================================================== | |
| -- CK Sistema de Gestión IA — FIX CRÍTICO RLS multi-tenant | |
| -- ===================================================================== | |
| -- Bug detectado en auditoría: has_module_access(module) retornaba true | |
| -- si el user tenía CUALQUIER membership con rol que da acceso al módulo, | |
| -- sin importar la org. Resultado: user con membership 'finanzas' en org A | |
| -- y 'rrhh' en org B podía leer facturas de B (donde su rol es solo rrhh). | |
| -- | |
| -- Fix: nueva firma has_module_access(org_id uuid, module text) que | |
| -- filtra el rol del user EN ESA org específica. |