1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/src/migrations/20240117093601-add-more-granular-project-permissions.js
Christopher Kolstad fa72ced1e5
feat: added more granular project permissions (#5932)
### What
Adds Read and Write permissions for project administration settings
(user access, change request settings, default strategy, other).

### Why
On request from two large customers that wanted our RBAC controls to be
more granulated to easier be able to limit the access they granted their
users.
2024-01-18 09:57:44 +01:00

27 lines
1.6 KiB
JavaScript

exports.up = function(db, cb) {
db.runSql(`
INSERT INTO permissions(permission, display_name, type) VALUES
('PROJECT_USER_ACCESS_READ', 'View only access to Project User Access', 'project'),
('PROJECT_DEFAULT_STRATEGY_READ', 'View only access to default strategy configuration for project', 'project'),
('PROJECT_CHANGE_REQUEST_READ', 'View only access to change request configuration for project', 'project'),
('PROJECT_SETTINGS_READ', 'View only access to project settings', 'project'),
('PROJECT_USER_ACCESS_WRITE', 'Write access to Project User Access', 'project'),
('PROJECT_DEFAULT_STRATEGY_WRITE', 'Write access to default strategy configuration for project', 'project'),
('PROJECT_CHANGE_REQUEST_WRITE', 'Write access to change request configuration for project', 'project'),
('PROJECT_SETTINGS_WRITE', 'Write access to project settings', 'project');
`, cb);
};
exports.down = function(db, cb) {
db.runSql(`
DELETE FROM permissions WHERE permission IN ('PROJECT_USER_ACCESS_READ',
'PROJECT_DEFAULT_STRATEGY_READ',
'PROJECT_CHANGE_REQUEST_READ',
'PROJECT_SETTINGS_READ',
'PROJECT_USER_ACCESS_WRITE',
'PROJECT_DEFAULT_STRATEGY_WRITE',
'PROJECT_CHANGE_REQUEST_WRITE',
'PROJECT_SETTINGS_WRITE');
`, cb);
};