1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-18 11:14:57 +02:00
unleash.unleash/src/migrations/20250203145735-drop-rp-view-permissions.js
Nuno Góis 138410eafd
chore: drop release plan template view permissions (#9195)
https://linear.app/unleash/issue/2-3225/drop-the-release-template-view-permissions

Drops the release plan template view permissions in favor of an "open by
default" approach.

Should merge the Enterprise PR first.
2025-02-03 16:24:25 +00:00

22 lines
966 B
JavaScript

exports.up = (db, cb) => {
db.runSql(`
DELETE
FROM permissions
WHERE permission IN
('RELEASE_PLAN_TEMPLATE_VIEW_OVERVIEW', 'RELEASE_PLAN_TEMPLATE_VIEW');
`, cb);
};
exports.down = (db, cb) => {
db.runSql(`
INSERT INTO permissions(permission, display_name, type) VALUES
('RELEASE_PLAN_TEMPLATE_VIEW_OVERVIEW', 'View overview of release plan templates', 'root'),
('RELEASE_PLAN_TEMPLATE_VIEW', 'View details of specific release plan template', 'root');
INSERT INTO role_permission(role_id, permission, created_by_user_id)
SELECT id, 'RELEASE_PLAN_TEMPLATE_VIEW_OVERVIEW', '-1337' FROM roles WHERE name IN ('Viewer', 'Editor') AND type = 'root';
INSERT INTO role_permission(role_id, permission, created_by_user_id)
SELECT id, 'RELEASE_PLAN_TEMPLATE_VIEW', '-1337' FROM roles WHERE name = 'Editor' AND type = 'root';
`, cb);
};