7525-devToTest #2542

Merged
alexm merged 231 commits from 7525-devToTest into test 2024-06-04 07:59:34 +00:00
2 changed files with 46 additions and 18 deletions
Showing only changes of commit 38bea60776 - Show all commits

View File

@ -1,18 +0,0 @@
INSERT INTO account.role
SET name = 'productionReviewer',
description = 'Revisor de producción',
hasLogin = TRUE,
created = util.VN_CURDATE(),
modified = util.VN_CURDATE(),
editorFk = NULL;
-- UPDATE salix.ACL
-- SET principalId = 'productionReviewer'
-- WHERE property = 'isInPreparing';
UPDATE account.user u
JOIN vn.workerDepartment wd ON wd.workerFk = u.id
JOIN vn.department d ON wd.departmentFk = d.id
JOIN account.role r ON r.name = 'productionReviewer'
SET u.role = r.id
WHERE d.name = 'REVISION';

View File

@ -0,0 +1,46 @@
use account;
INSERT INTO account.role
SET name = 'reviewer',
description = 'Revisor de producción',
hasLogin = TRUE,
created = util.VN_CURDATE(),
modified = util.VN_CURDATE(),
editorFk = NULL;
INSERT IGNORE INTO account.roleInherit(
role,
inheritsFrom
)
SELECT r1.id,
r2.id
FROM account.role r1
JOIN account.role r2
WHERE r2.name = 'production'
AND r1.name = 'reviewer'
UNION
SELECT ri.role,
r2.id
FROM account.roleInherit ri
JOIN account.role r1 ON r1.id = ri.role
JOIN account.role r2 ON r2.name = 'reviewer'
WHERE r1.name IN ('claimManager', 'productionBoss')
GROUP BY ri.role;
DELETE ri
FROM account.roleInherit ri
JOIN account.role r1 ON ri.role = r1.id
JOIN account.role r2 ON ri.inheritsFrom = r2.id
WHERE r1.name = 'replenisher'
AND r2.name = 'buyer';
UPDATE salix.ACL
SET principalId = 'reviewer'
WHERE property = 'isInPreparing';
UPDATE account.user u
JOIN vn.workerDepartment wd ON wd.workerFk = u.id
JOIN vn.department d ON wd.departmentFk = d.id
JOIN account.role r ON r.name = 'reviewer'
SET u.role = r.id
WHERE d.name IN ('REVISION', 'PREVIA');