Skip to content

Commit

Permalink
fix: editor can add dependencies in default project (#8077)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Sep 4, 2024
1 parent f41a688 commit d220aae
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
);
};

0 comments on commit d220aae

Please sign in to comment.