@spytecgps/nova-orm 1.4.76 → 1.4.78

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,5 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class createUserAuthorizedBoundarySecurityViewV21684483705000 implements MigrationInterface {
3
+ up(queryRunner: QueryRunner): Promise<void>;
4
+ down(queryRunner: QueryRunner): Promise<void>;
5
+ }
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ class createUserAuthorizedBoundarySecurityViewV21684483705000 {
4
+ async up(queryRunner) {
5
+ await queryRunner.query(`
6
+ CREATE OR REPLACE VIEW \`user_authorized_boundary_security_view_v2\` AS
7
+ (
8
+ SELECT
9
+ b.clientId AS clientId,
10
+ usr.userId AS userId,
11
+ b.id AS boundaryId
12
+ FROM userSecurityRole usr
13
+ JOIN boundary b
14
+ ON b.clientId = usr.clientId
15
+ WHERE usr.boundariesAccess = 'full'
16
+ AND NOT EXISTS (
17
+ SELECT 1
18
+ FROM entityTag ut
19
+ WHERE ut.userId = usr.userId
20
+ AND ut.entityType = 'User'
21
+ AND ut.isSecurityGroup = 1
22
+ )
23
+ )
24
+ UNION
25
+ (
26
+ SELECT
27
+ b.clientId AS clientId,
28
+ usr.userId AS userId,
29
+ b.id AS boundaryId
30
+ FROM entityTag ut
31
+ JOIN entityTag rt
32
+ ON rt.tagId = ut.tagId
33
+ AND rt.entityType = 'Boundary'
34
+ AND rt.isSecurityGroup = 1
35
+ JOIN boundary b
36
+ ON b.id = rt.entityId
37
+ JOIN userSecurityRole usr
38
+ ON usr.userId = ut.userId
39
+ AND usr.clientId = b.clientId
40
+ WHERE ut.entityType = 'User'
41
+ AND ut.isSecurityGroup = 1
42
+ )
43
+ UNION
44
+ (
45
+ SELECT
46
+ uab.clientId AS clientId,
47
+ uab.userId AS userId,
48
+ uab.boundaryId AS boundaryId
49
+ FROM userAuthorizedBoundary uab
50
+ WHERE NOT EXISTS (
51
+ SELECT 1
52
+ FROM userSecurityRole usr
53
+ WHERE usr.clientId = uab.clientId
54
+ AND usr.userId = uab.userId
55
+ AND usr.boundariesAccess = 'full'
56
+ )
57
+ AND NOT EXISTS (
58
+ SELECT 1
59
+ FROM entityTag ut
60
+ JOIN entityTag rt
61
+ ON rt.tagId = ut.tagId
62
+ AND rt.entityType = 'Boundary'
63
+ AND rt.isSecurityGroup = 1
64
+ JOIN boundary b
65
+ ON b.id = rt.entityId
66
+ JOIN userSecurityRole usr
67
+ ON usr.userId = ut.userId
68
+ AND usr.clientId = b.clientId
69
+ WHERE ut.entityType = 'User'
70
+ AND ut.isSecurityGroup = 1
71
+ AND b.clientId = uab.clientId
72
+ AND b.id = uab.boundaryId
73
+ AND ut.userId = uab.userId
74
+ )
75
+ );
76
+ `);
77
+ }
78
+ async down(queryRunner) {
79
+ await queryRunner.query(`
80
+ DROP VIEW IF EXISTS \`user_authorized_boundary_security_view_v2\`;
81
+ `);
82
+ }
83
+ }
84
+
85
+ exports.createUserAuthorizedBoundarySecurityViewV21684483705000 = createUserAuthorizedBoundarySecurityViewV21684483705000;
@@ -0,0 +1,5 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class createUserAuthorizedDeviceSecurityViewV21684483706000 implements MigrationInterface {
3
+ up(queryRunner: QueryRunner): Promise<void>;
4
+ down(queryRunner: QueryRunner): Promise<void>;
5
+ }
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ class createUserAuthorizedDeviceSecurityViewV21684483706000 {
4
+ async up(queryRunner) {
5
+ await queryRunner.query(`
6
+ CREATE OR REPLACE VIEW \`user_authorized_device_security_view_v2\` AS
7
+ (
8
+ SELECT
9
+ d.clientId AS clientId,
10
+ d.imei AS imei,
11
+ usr.userId AS userId
12
+ FROM userSecurityRole usr
13
+ JOIN device d
14
+ ON d.clientId = usr.clientId
15
+ WHERE usr.access = 'full'
16
+ AND NOT EXISTS (
17
+ SELECT 1
18
+ FROM entityTag ut
19
+ WHERE ut.userId = usr.userId
20
+ AND ut.entityType = 'User'
21
+ AND ut.isSecurityGroup = 1
22
+ )
23
+ )
24
+ UNION
25
+ (
26
+ SELECT
27
+ d.clientId AS clientId,
28
+ d.imei AS imei,
29
+ usr.userId AS userId
30
+ FROM entityTag ut
31
+ JOIN entityTag rt
32
+ ON rt.tagId = ut.tagId
33
+ AND rt.entityType = 'Device'
34
+ AND rt.isSecurityGroup = 1
35
+ JOIN device d
36
+ ON d.imei = rt.imei
37
+ JOIN userSecurityRole usr
38
+ ON usr.userId = ut.userId
39
+ AND usr.clientId = d.clientId
40
+ WHERE ut.entityType = 'User'
41
+ AND ut.isSecurityGroup = 1
42
+ )
43
+ UNION (
44
+ SELECT
45
+ uad.clientId AS clientId,
46
+ uad.imei AS imei,
47
+ uad.userId AS userId
48
+ FROM userAuthorizedDevice uad
49
+ WHERE NOT EXISTS (
50
+ SELECT 1
51
+ FROM userSecurityRole usr
52
+ WHERE usr.clientId = uad.clientId
53
+ AND usr.userId = uad.userId
54
+ AND usr.access = 'full'
55
+ )
56
+ AND NOT EXISTS (
57
+ SELECT 1
58
+ FROM entityTag ut
59
+ JOIN userSecurityRole usr
60
+ ON usr.userId = ut.userId
61
+ WHERE ut.entityType = 'User'
62
+ AND ut.isSecurityGroup = 1
63
+ )
64
+ );
65
+ `);
66
+ }
67
+ async down(queryRunner) {
68
+ await queryRunner.query(`DROP VIEW IF EXISTS \`user_authorized_device_security_view_v2\`;`);
69
+ }
70
+ }
71
+
72
+ exports.createUserAuthorizedDeviceSecurityViewV21684483706000 = createUserAuthorizedDeviceSecurityViewV21684483706000;
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var _1684483704434AddLowerCaseIndex = require('../1684483704434-addLowerCaseIndex.js');
4
+ var _1684483706000CreateUserAuthorizedDeviceSecurityViewV2 = require('../1684483706000-createUserAuthorizedDeviceSecurityViewV2.js');
5
+ var _1684483705000CreateUserAuthorizedBoundarySecurityViewV2 = require('../1684483705000-createUserAuthorizedBoundarySecurityViewV2.js');
4
6
 
5
7
 
6
8
 
7
9
  exports.addLowerCaseIndex1684483704434 = _1684483704434AddLowerCaseIndex.addLowerCaseIndex1684483704434;
10
+ exports.createUserAuthorizedDeviceSecurityViewV21684483706000 = _1684483706000CreateUserAuthorizedDeviceSecurityViewV2.createUserAuthorizedDeviceSecurityViewV21684483706000;
11
+ exports.createUserAuthorizedBoundarySecurityViewV21684483705000 = _1684483705000CreateUserAuthorizedBoundarySecurityViewV2.createUserAuthorizedBoundarySecurityViewV21684483705000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "1.4.76",
3
+ "version": "1.4.78",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",