salix/db/changes/234001/01-deliveryAssistantACL.sql

22 lines
1015 B
SQL

-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
INSERT INTO `account`.`role` (name, description)
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
SELECT (SELECT id FROM account.role r1 WHERE r1.name = 'deliveryAssistant'), ri.inheritsFrom
FROM account.roleInherit ri
JOIN account.role r2 ON r2.id = ri.`role`
WHERE r2.name = 'deliveryBoss';
DELETE `account`.`roleInherit` FROM `account`.`roleInherit`
JOIN `account`.`role` r ON `account`.`roleInherit`.role = r.id
WHERE r.name = 'deliveryBoss';
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
SELECT (SELECT id FROM account.role WHERE name = 'deliveryBoss') role,
(SELECT id FROM account.role WHERE name = 'deliveryAssistant') roleInherit;
UPDATE `salix`.`ACL`
SET principalId='deliveryAssistant'
WHERE principalId='deliveryBoss';