Skip to content

Commit

Permalink
feat: added more granular project permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswk committed Jan 17, 2024
1 parent 5fb2ac8 commit bf8b444
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/types/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export const APPROVE_CHANGE_REQUEST = 'APPROVE_CHANGE_REQUEST';
export const APPLY_CHANGE_REQUEST = 'APPLY_CHANGE_REQUEST';
export const SKIP_CHANGE_REQUEST = 'SKIP_CHANGE_REQUEST';

export const PROJECT_USER_ACCESS_READ = 'PROJECT_USER_ACCESS_READ';
export const PROJECT_DEFAULT_STRATEGY_READ = 'PROJECT_DEFAULT_STRATEGY_READ';
export const PROJECT_CHANGE_REQUEST_READ = 'PROJECT_CHANGE_REQUEST_READ';
export const PROJECT_SETTINGS_READ = 'PROJECT_SETTINGS_READ';
export const PROJECT_USER_ACCESS_WRITE = 'PROJECT_USER_ACCESS_WRITE';
export const PROJECT_DEFAULT_STRATEGY_WRITE = 'PROJECT_DEFAULT_STRATEGY_WRITE';
export const PROJECT_CHANGE_REQUEST_WRITE = 'PROJECT_CHANGE_REQUEST_WRITE';
export const PROJECT_SETTINGS_WRITE = 'PROJECT_SETTINGS_WRITE';
export const ROOT_PERMISSION_CATEGORIES = [
{
label: 'Addon',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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);
};

0 comments on commit bf8b444

Please sign in to comment.