The new permission was missing from the admin role seed in init.sql and needed an idempotent update script for existing installations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
10 lines
397 B
SQL
10 lines
397 B
SQL
-- Helpdesk module: assign software products permission to Admin role.
|
|
-- Idempotent: safe to run multiple times.
|
|
|
|
INSERT INTO `role_permissions` (`role_id`, `permission_id`, `created`)
|
|
SELECT r.id, p.id, NOW()
|
|
FROM roles r
|
|
JOIN permissions p ON p.`key` = 'helpdesk.software-products.manage'
|
|
WHERE r.description IN ('Admin', 'Administrator') OR r.id = 1
|
|
ON DUPLICATE KEY UPDATE role_id = role_id;
|