1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: editor can add dependencies in default project (#8077)

This commit is contained in:
Mateusz Kwasniewski 2024-09-04 11:25:32 +02:00 committed by GitHub
parent f41a688edb
commit d220aaec0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,28 @@
exports.up = function (db, cb) {
db.runSql(
`
INSERT INTO role_permission (role_id, permission)
SELECT id, 'UPDATE_FEATURE_DEPENDENCY'
FROM roles WHERE name = 'Editor' AND type = 'root'
AND EXISTS (SELECT 1 FROM roles WHERE name = 'Editor' and type = 'root')
AND NOT EXISTS (
SELECT 1
FROM role_permission
WHERE role_permission.role_id = (SELECT id FROM roles WHERE name = 'Editor' AND type = 'root')
AND role_permission.permission = 'UPDATE_FEATURE_DEPENDENCY'
);
`,
cb
);
};
exports.down = function (db, cb) {
db.runSql(
`
DELETE FROM role_permission
WHERE role_id = (SELECT id FROM roles WHERE name = 'Editor' AND type = 'root')
AND permission = 'UPDATE_FEATURE_DEPENDENCY';
`,
cb
);
};