-
-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new permission for moving project
- Loading branch information
1 parent
64f9d51
commit e8db1da
Showing
4 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/migrations/20220111115613-move-feature-toggle-permission.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
exports.up = function (db, cb) { | ||
db.runSql( | ||
` | ||
INSERT INTO permissions (permission, display_name, type) VALUES ('MOVE_FEATURE_TOGGLE', 'Change feature toggle project', 'project'); | ||
INSERT INTO role_permission (role_id, permission_id, environment) | ||
SELECT | ||
(SELECT id as role_id from roles WHERE name = 'Editor' LIMIT 1), | ||
p.id as permission_id, | ||
'*' as environment | ||
FROM permissions p | ||
WHERE p.permission IN | ||
('MOVE_FEATURE_TOGGLE'); | ||
INSERT INTO role_permission (role_id, permission_id, environment) | ||
SELECT | ||
(SELECT id as role_id from roles WHERE name = 'Owner' LIMIT 1), | ||
p.id as permission_id, | ||
'*' as environment | ||
FROM permissions p | ||
WHERE p.permission IN | ||
('MOVE_FEATURE_TOGGLE'); | ||
`, | ||
cb, | ||
); | ||
}; | ||
|
||
exports.down = function (db, cb) { | ||
db.runSql( | ||
` | ||
DELETE FROM permissions WHERE permission = 'MOVE_FEATURE_TOGGLE'; | ||
`, | ||
cb, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters