unleash-server 4.3.1 → 4.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ const async = require('async');
3
+ function resolveRoleName(permissions) {
4
+ if (!permissions || permissions.length === 0) {
5
+ return 'Viewer';
6
+ }
7
+ if (permissions.includes('ADMIN')) {
8
+ return 'Admin';
9
+ }
10
+ return 'Editor';
11
+ }
12
+ exports.up = function (db, cb) {
13
+ db.runSql('ALTER TABLE roles ADD COLUMN IF NOT EXISTS project text', cb);
14
+ };
15
+ exports.down = function (db, cb) {
16
+ // We can't just remove roles for users as we don't know if there has been any manual additions.
17
+ cb();
18
+ };
19
+ //# sourceMappingURL=20210428103922-patch-role-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20210428103922-patch-role-table.js","sourceRoot":"","sources":["../../src/migrations/20210428103922-patch-role-table.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B,SAAS,eAAe,CAAC,WAAW;IAChC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1C,OAAO,QAAQ,CAAC;KACnB;IACD,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC/B,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL,yDAAyD,EAAE,EAAE,CAChE,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,gGAAgG;IAChG,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+ exports.up = function (db, cb) {
3
+ db.runSql(`
4
+ UPDATE roles set name='Admin' where name='Super User';
5
+ `, cb);
6
+ };
7
+ exports.down = function (db, cb) {
8
+ // We can't just remove roles for users as we don't know if there has been any manual additions.
9
+ cb();
10
+ };
11
+ //# sourceMappingURL=20210428103924-patch-admin-role-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20210428103924-patch-admin-role-name.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-admin-role-name.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;SAEC,EACD,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,gGAAgG;IAChG,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+ exports.up = function (db, cb) {
3
+ db.runSql(`
4
+ DO $$
5
+ declare
6
+ begin
7
+ WITH admin AS (
8
+ SELECT * FROM roles WHERE name in ('Admin', 'Super User') LIMIT 1
9
+ )
10
+ INSERT into role_user(role_id, user_id)
11
+ VALUES
12
+ ((select id from admin), (select id FROM users where username='admin' LIMIT 1));
13
+
14
+ EXCEPTION WHEN OTHERS THEN
15
+ raise notice 'Ignored';
16
+ end;
17
+ $$;`, cb);
18
+ };
19
+ exports.down = function (db, cb) {
20
+ // We can't just remove roles for users as we don't know if there has been any manual additions.
21
+ cb();
22
+ };
23
+ //# sourceMappingURL=20210428103924-patch-admin_role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20210428103924-patch-admin_role.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-admin_role.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;;;;;;;;;;;;;YAcI,EACJ,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,gGAAgG;IAChG,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+ exports.up = function (db, cb) {
3
+ db.runSql(`
4
+ DO $$
5
+ declare
6
+ begin
7
+ WITH editor AS (
8
+ SELECT * FROM roles WHERE name in ('Editor', 'Regular') LIMIT 1
9
+ )
10
+
11
+ INSERT INTO role_permission(role_id, project, permission)
12
+ VALUES
13
+ ((SELECT id from editor), '', 'CREATE_STRATEGY'),
14
+ ((SELECT id from editor), '', 'UPDATE_STRATEGY'),
15
+ ((SELECT id from editor), '', 'DELETE_STRATEGY'),
16
+
17
+ ((SELECT id from editor), '', 'UPDATE_APPLICATION'),
18
+
19
+ ((SELECT id from editor), '', 'CREATE_CONTEXT_FIELD'),
20
+ ((SELECT id from editor), '', 'UPDATE_CONTEXT_FIELD'),
21
+ ((SELECT id from editor), '', 'DELETE_CONTEXT_FIELD'),
22
+
23
+ ((SELECT id from editor), '', 'CREATE_PROJECT'),
24
+
25
+ ((SELECT id from editor), '', 'CREATE_ADDON'),
26
+ ((SELECT id from editor), '', 'UPDATE_ADDON'),
27
+ ((SELECT id from editor), '', 'DELETE_ADDON'),
28
+
29
+ ((SELECT id from editor), 'default', 'UPDATE_PROJECT'),
30
+ ((SELECT id from editor), 'default', 'DELETE_PROJECT'),
31
+ ((SELECT id from editor), 'default', 'CREATE_FEATURE'),
32
+ ((SELECT id from editor), 'default', 'UPDATE_FEATURE'),
33
+ ((SELECT id from editor), 'default', 'DELETE_FEATURE');
34
+
35
+ -- Clean up duplicates
36
+ DELETE FROM role_permission p1
37
+ USING role_permission p2
38
+ WHERE p1.created_at < p2.created_at -- select the "older" ones
39
+ AND p1.project = p2.project -- list columns that define duplicates
40
+ AND p1.permission = p2.permission;
41
+ EXCEPTION WHEN OTHERS THEN
42
+ raise notice 'Ignored';
43
+ end;
44
+ $$;`, cb);
45
+ };
46
+ exports.down = function (db, cb) {
47
+ // We can't just remove roles for users as we don't know if there has been any manual additions.
48
+ cb();
49
+ };
50
+ //# sourceMappingURL=20210428103924-patch-role_permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20210428103924-patch-role_permissions.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-role_permissions.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCI,EACJ,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,gGAAgG;IAChG,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unleash-server",
3
3
  "description": "Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.",
4
- "version": "4.3.1",
4
+ "version": "4.3.4",
5
5
  "keywords": [
6
6
  "unleash",
7
7
  "feature toggle",
@@ -111,7 +111,7 @@
111
111
  "response-time": "^2.3.2",
112
112
  "serve-favicon": "^2.5.0",
113
113
  "stoppable": "^1.1.0",
114
- "unleash-frontend": "4.3.0",
114
+ "unleash-frontend": "4.3.2",
115
115
  "uuid": "^8.3.2"
116
116
  },
117
117
  "devDependencies": {