d60b4b1d77
Admin/superadmin dan acceso de solo lectura (Resumen, Equipos, Software) a otros usuarios; el backend valida el acceso en cada endpoint y el menu aparece solo a quien lo tenga. Migracion 026 (device_viewers). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
10 lines
582 B
SQL
10 lines
582 B
SQL
-- Acceso de solo lectura al menu Equipos para usuarios que por su rol no lo ven (compartir el modulo).
|
|
-- Lo gestionan admin/superadmin. Idempotente.
|
|
CREATE TABLE IF NOT EXISTS device_viewers (
|
|
user_id INT NOT NULL PRIMARY KEY,
|
|
granted_by INT NULL,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
CONSTRAINT fk_device_viewers_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
|
CONSTRAINT fk_device_viewers_granter FOREIGN KEY (granted_by) REFERENCES users(id) ON DELETE SET NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|