1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/src/migrations/20230130113337-revert-user-pat-permissions.js
Nuno Góis 054c590813
fix: limit creation of other users PATs (adapting) (#3019)
https://linear.app/unleash/issue/2-656/limit-the-ability-of-creating-a-token-on-behalf-of-another-user

Adapts to the refactor that reverts the initial experimental idea of
Service Accounts before they existed in the current implementation:
Managing other user's PATs.
2023-01-31 08:40:23 +00:00

22 lines
793 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
DELETE FROM permissions WHERE permission = 'READ_USER_PAT';
DELETE FROM permissions WHERE permission = 'CREATE_USER_PAT';
DELETE FROM permissions WHERE permission = 'DELETE_USER_PAT';
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
INSERT INTO permissions (permission, display_name, type) VALUES ('READ_USER_PAT', 'Read PATs for a specific user', 'root');
INSERT INTO permissions (permission, display_name, type) VALUES ('CREATE_USER_PAT', 'Create a PAT for a specific user', 'root');
INSERT INTO permissions (permission, display_name, type) VALUES ('DELETE_USER_PAT', 'Delete a PAT for a specific user', 'root');
`,
cb,
);
};