bmc_hub/migrations/1013_sag_permissions.sql
Christian d81a8f41b4 feat: Add end-to-end tests for Sag module HTTP API
- Implemented a comprehensive end-to-end testing script for the Sag module's HTTP API, covering various functionalities including case creation, updates, and file uploads.
- Introduced a safe HTML sanitizer utility to ensure safe rendering of HTML content in the BMC Hub UI.
- Added database migrations for new features including WAN connection marking for wall outlets, permanent audit trails for supplier invoices, and dedicated permissions for the Sag module.
- Created a migration center for manual subscription and invoice migrations with relevant tables and indexes.
- Added tests for migration center functionalities, ensuring stability and correctness of the new features.
2026-07-28 14:18:24 +02:00

25 lines
1.0 KiB
SQL

-- Dedicated permissions for the Sag module.
-- Existing group access is preserved by copying equivalent ticket permissions.
INSERT INTO permissions (code, description, category) VALUES
('cases.view', 'Se sager', 'cases'),
('cases.create', 'Opret sager', 'cases'),
('cases.edit', 'Redigér sager, relationer, filer og reminders', 'cases'),
('cases.delete', 'Slet sager', 'cases')
ON CONFLICT (code) DO NOTHING;
WITH permission_map(case_code, ticket_code) AS (
VALUES
('cases.view', 'tickets.view'),
('cases.create', 'tickets.create'),
('cases.edit', 'tickets.edit'),
('cases.delete', 'tickets.delete')
)
INSERT INTO group_permissions (group_id, permission_id)
SELECT DISTINCT gp.group_id, case_permission.id
FROM group_permissions gp
JOIN permissions ticket_permission ON ticket_permission.id = gp.permission_id
JOIN permission_map mapping ON mapping.ticket_code = ticket_permission.code
JOIN permissions case_permission ON case_permission.code = mapping.case_code
ON CONFLICT DO NOTHING;