@tomei/sso 0.66.0 → 0.66.1-test.1

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.
Files changed (84) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.gitlab-ci.yml +237 -16
  3. package/.husky/commit-msg +15 -15
  4. package/.husky/pre-commit +7 -7
  5. package/.prettierrc +4 -4
  6. package/Jenkinsfile +57 -57
  7. package/README.md +23 -23
  8. package/__tests__/unit/components/api-key/api-key.spec.ts +201 -0
  9. package/__tests__/unit/components/group/group.spec.ts +85 -79
  10. package/__tests__/unit/components/group-object-privilege/group-object-privilege.spec.ts +88 -88
  11. package/__tests__/unit/components/group-privilege/group-privilege.spec.ts +68 -68
  12. package/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.ts +79 -67
  13. package/__tests__/unit/components/group-system-access/group-system-access.spec.ts +83 -83
  14. package/__tests__/unit/components/login-user/l.spec.ts +746 -746
  15. package/__tests__/unit/components/login-user/login.spec.ts +2327 -1164
  16. package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
  17. package/__tests__/unit/components/system/system.spec.ts +255 -254
  18. package/__tests__/unit/components/system-privilege/system-privilege.spec.ts +83 -83
  19. package/__tests__/unit/components/user-group/user-group.spec.ts +86 -86
  20. package/__tests__/unit/components/user-object-privilege/user-object-privilege.spec.ts +78 -78
  21. package/__tests__/unit/components/user-password-history/user-password-history.spec.ts +165 -0
  22. package/__tests__/unit/components/user-privilege/user-privilege.spec.ts +72 -72
  23. package/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.ts +233 -0
  24. package/__tests__/unit/components/user-system-access/user-system-access.spec.ts +89 -89
  25. package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
  26. package/__tests__/unit/session/session.service.spec.ts +47 -47
  27. package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
  28. package/coverage/cobertura-coverage.xml +237 -0
  29. package/coverage/test-report.xml +33 -0
  30. package/create-sso-user.sql +39 -39
  31. package/dist/__tests__/unit/components/{group-privilege/group-privilege.test.d.ts → api-key/api-key.spec.d.ts} +1 -1
  32. package/dist/__tests__/unit/components/api-key/api-key.spec.js +158 -0
  33. package/dist/__tests__/unit/components/api-key/api-key.spec.js.map +1 -0
  34. package/dist/__tests__/unit/components/group/group.spec.js +4 -0
  35. package/dist/__tests__/unit/components/group/group.spec.js.map +1 -1
  36. package/dist/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.js +15 -3
  37. package/dist/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.js.map +1 -1
  38. package/dist/__tests__/unit/components/login-user/login.spec.js +664 -0
  39. package/dist/__tests__/unit/components/login-user/login.spec.js.map +1 -1
  40. package/dist/__tests__/unit/components/system/system.spec.js +1 -0
  41. package/dist/__tests__/unit/components/system/system.spec.js.map +1 -1
  42. package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.d.ts +1 -0
  43. package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.js +138 -0
  44. package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.js.map +1 -0
  45. package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.d.ts +1 -0
  46. package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.js +182 -0
  47. package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.js.map +1 -0
  48. package/dist/src/components/login-user/login-user.js +2 -2
  49. package/dist/src/components/login-user/login-user.js.map +1 -1
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/eslint.config.mjs +58 -58
  52. package/jest.config.js +16 -14
  53. package/migrations/20240314080602-create-user-table.js +124 -124
  54. package/migrations/20240314080603-create-user-group-table.js +85 -85
  55. package/migrations/20240314080604-create-user-user-group-table.js +55 -55
  56. package/migrations/20240314080605-create-login-history-table.js +53 -53
  57. package/migrations/20240527064925-create-system-table.js +78 -78
  58. package/migrations/20240527064926-create-system-privilege-table.js +71 -71
  59. package/migrations/20240527065342-create-group-table.js +93 -93
  60. package/migrations/20240527065633-create-group-reporting-user-table.js +76 -76
  61. package/migrations/20240528011551-create-group-system-access-table.js +72 -72
  62. package/migrations/20240528023018-user-system-access-table.js +75 -75
  63. package/migrations/20240528032229-user-privilege-table.js +76 -76
  64. package/migrations/20240528063003-create-group-privilege-table.js +76 -76
  65. package/migrations/20240528063051-create-group-object-privilege-table.js +84 -84
  66. package/migrations/20240528063107-create-user-object-privilege-table.js +84 -84
  67. package/migrations/20240528063108-create-api-key-table.js +85 -85
  68. package/migrations/20241104104802-create-building-table.js +95 -95
  69. package/migrations/20250108091132-add-area-manager-user-id-to-building-table.js +14 -14
  70. package/migrations/20250108091133-add-passcode-to-user-table.js +36 -36
  71. package/migrations/20250210115636-create-user-reporting-hierarchy.js +76 -76
  72. package/migrations/20250326043818-crate-user-password-history.js +42 -42
  73. package/migrations/20250610070720-added-MFBypassYN-to-sso-user.js +30 -30
  74. package/migrations/20250805085707-add-bulk-approval-code-to-sso-user.js +29 -0
  75. package/package.json +88 -90
  76. package/sampledotenv +7 -7
  77. package/src/components/login-user/login-user.ts +2 -2
  78. package/tsconfig.build.json +5 -5
  79. package/tsconfig.json +23 -23
  80. package/dist/__tests__/unit/components/group-privilege/group-privilege.test.js +0 -71
  81. package/dist/__tests__/unit/components/group-privilege/group-privilege.test.js.map +0 -1
  82. package/dist/__tests__/unit/components/login-user/login-user.spec.d.ts +0 -0
  83. package/dist/__tests__/unit/components/login-user/login-user.spec.js +0 -6
  84. package/dist/__tests__/unit/components/login-user/login-user.spec.js.map +0 -1
@@ -1,47 +1,47 @@
1
- import { IUserSession } from '../../../src/interfaces/user-session.interface';
2
- import { SessionService } from '../../../src/session/session.service';
3
- require('dotenv').config()
4
-
5
- describe('session.service', () => {
6
- it('should return session service when instansiated', async () => {
7
- const sessionService = await SessionService.init();
8
- expect(sessionService).toBeDefined();
9
- });
10
-
11
- it('should able to write session data', async () => {
12
- const data: IUserSession = {
13
- systemLogins: [
14
- {
15
- id: '1',
16
- code: 'EZC',
17
- sessionId: 'test1',
18
- privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
19
- },
20
- ],
21
- };
22
- const sessionService = await SessionService.init();
23
- await sessionService.setUserSession("1", data)
24
- const result = await sessionService.retrieveUserSession("1");
25
- expect(result).toEqual(data);
26
- });
27
-
28
- it('should able to refresh session data', async () => {
29
- const setUserSession = jest.spyOn(SessionService.prototype, 'setUserSession');
30
- const retrieveUserSession = jest.spyOn(SessionService.prototype, 'retrieveUserSession');
31
- const data: IUserSession = {
32
- systemLogins: [
33
- {
34
- id: '1',
35
- code: 'EZC',
36
- sessionId: 'test1',
37
- privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
38
- },
39
- ],
40
- };
41
- const sessionService = await SessionService.init();
42
- await sessionService.setUserSession("1", data)
43
- await sessionService.refreshDuration("1");
44
- expect(setUserSession).toHaveBeenCalledTimes(2);
45
- expect(retrieveUserSession).toHaveBeenCalledTimes(1);
46
- });
47
- });
1
+ import { IUserSession } from '../../../src/interfaces/user-session.interface';
2
+ import { SessionService } from '../../../src/session/session.service';
3
+ require('dotenv').config()
4
+
5
+ describe('session.service', () => {
6
+ it('should return session service when instansiated', async () => {
7
+ const sessionService = await SessionService.init();
8
+ expect(sessionService).toBeDefined();
9
+ });
10
+
11
+ it('should able to write session data', async () => {
12
+ const data: IUserSession = {
13
+ systemLogins: [
14
+ {
15
+ id: '1',
16
+ code: 'EZC',
17
+ sessionId: 'test1',
18
+ privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
19
+ },
20
+ ],
21
+ };
22
+ const sessionService = await SessionService.init();
23
+ await sessionService.setUserSession("1", data)
24
+ const result = await sessionService.retrieveUserSession("1");
25
+ expect(result).toEqual(data);
26
+ });
27
+
28
+ it('should able to refresh session data', async () => {
29
+ const setUserSession = jest.spyOn(SessionService.prototype, 'setUserSession');
30
+ const retrieveUserSession = jest.spyOn(SessionService.prototype, 'retrieveUserSession');
31
+ const data: IUserSession = {
32
+ systemLogins: [
33
+ {
34
+ id: '1',
35
+ code: 'EZC',
36
+ sessionId: 'test1',
37
+ privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
38
+ },
39
+ ],
40
+ };
41
+ const sessionService = await SessionService.init();
42
+ await sessionService.setUserSession("1", data)
43
+ await sessionService.refreshDuration("1");
44
+ expect(setUserSession).toHaveBeenCalledTimes(2);
45
+ expect(retrieveUserSession).toHaveBeenCalledTimes(1);
46
+ });
47
+ });
@@ -1,91 +1,91 @@
1
- // import { Privilege } from '../../../src/components/system-privilege/privilege';
2
- // import { SystemPrivilegeRepository } from '../../../src/components/system-privilege/system-privilege.repository';
3
- // import { SystemRepository } from '../../../src/components/system/system.repository';
4
- // describe('SystemPrivilege', () => {
5
- // afterEach(async () => {
6
- // jest.restoreAllMocks();
7
- // });
8
- // it('should be able to load single package privileges', async () => {
9
- // let privilegeCalled = 0;
10
- // const findOrCreateMock = jest
11
- // .spyOn(SystemPrivilegeRepository.prototype, 'findOrCreate')
12
- // .mockResolvedValueOnce([{}, true] as any);
13
-
14
- // const systemRepositoryMock = jest
15
- // .spyOn(SystemRepository.prototype, 'findOne')
16
- // .mockResolvedValueOnce({
17
- // id: 175,
18
- // } as any);
19
-
20
- // jest.mock('@tomei/mailer/privileges.json', () => {
21
- // privilegeCalled++;
22
- // return {
23
- // Privileges: [
24
- // {
25
- // Code: 'Privilege1',
26
- // Description: 'This is Privilege1',
27
- // },
28
- // ],
29
- // };
30
- // });
31
-
32
- // await Privilege.loadPrivileges('mailer', 'EZC');
33
- // expect(findOrCreateMock).toBeCalledTimes(1);
34
- // expect(systemRepositoryMock).toBeCalledTimes(1);
35
- // expect(privilegeCalled).toEqual(1);
36
- // });
37
-
38
- // it('should be able to load multiple package privileges', async () => {
39
- // let privilegeCalled = 0;
40
- // const findOrCreateMock = jest
41
- // .spyOn(SystemPrivilegeRepository.prototype, 'findOrCreate')
42
- // .mockResolvedValueOnce([{}, true] as any);
43
-
44
- // const systemRepositoryMock = jest
45
- // .spyOn(SystemRepository.prototype, 'findOne')
46
- // .mockResolvedValueOnce({
47
- // id: 175,
48
- // } as any);
49
-
50
- // jest.mock(
51
- // '@tomei/mailer/privileges.json',
52
- // () => {
53
- // privilegeCalled++;
54
- // return {
55
- // Privileges: [
56
- // {
57
- // Code: 'Privilege1',
58
- // Description: 'This is Privilege1',
59
- // },
60
- // ],
61
- // };
62
- // },
63
- // );
64
-
65
- // jest.mock(
66
- // '@tomei/config/privileges.json',
67
- // () => {
68
- // privilegeCalled++;
69
- // return {
70
- // Privileges: [
71
- // {
72
- // Code: 'Privilege2',
73
- // Description: 'This is Privilege2',
74
- // },
75
- // ],
76
- // };
77
- // },
78
- // );
79
-
80
- // await Privilege.loadPrivileges(['mailer', 'config'], 'EZC');
81
- // expect(findOrCreateMock).toBeCalledTimes(2);
82
- // expect(systemRepositoryMock).toBeCalledTimes(1);
83
- // expect(privilegeCalled).toEqual(2);
84
- // });
85
- // });
86
-
87
- describe('SystemPrivilege', () => {
88
- it('should be true', () => {
89
- expect(true).toBe(true);
90
- });
91
- });
1
+ // import { Privilege } from '../../../src/components/system-privilege/privilege';
2
+ // import { SystemPrivilegeRepository } from '../../../src/components/system-privilege/system-privilege.repository';
3
+ // import { SystemRepository } from '../../../src/components/system/system.repository';
4
+ // describe('SystemPrivilege', () => {
5
+ // afterEach(async () => {
6
+ // jest.restoreAllMocks();
7
+ // });
8
+ // it('should be able to load single package privileges', async () => {
9
+ // let privilegeCalled = 0;
10
+ // const findOrCreateMock = jest
11
+ // .spyOn(SystemPrivilegeRepository.prototype, 'findOrCreate')
12
+ // .mockResolvedValueOnce([{}, true] as any);
13
+
14
+ // const systemRepositoryMock = jest
15
+ // .spyOn(SystemRepository.prototype, 'findOne')
16
+ // .mockResolvedValueOnce({
17
+ // id: 175,
18
+ // } as any);
19
+
20
+ // jest.mock('@tomei/mailer/privileges.json', () => {
21
+ // privilegeCalled++;
22
+ // return {
23
+ // Privileges: [
24
+ // {
25
+ // Code: 'Privilege1',
26
+ // Description: 'This is Privilege1',
27
+ // },
28
+ // ],
29
+ // };
30
+ // });
31
+
32
+ // await Privilege.loadPrivileges('mailer', 'EZC');
33
+ // expect(findOrCreateMock).toBeCalledTimes(1);
34
+ // expect(systemRepositoryMock).toBeCalledTimes(1);
35
+ // expect(privilegeCalled).toEqual(1);
36
+ // });
37
+
38
+ // it('should be able to load multiple package privileges', async () => {
39
+ // let privilegeCalled = 0;
40
+ // const findOrCreateMock = jest
41
+ // .spyOn(SystemPrivilegeRepository.prototype, 'findOrCreate')
42
+ // .mockResolvedValueOnce([{}, true] as any);
43
+
44
+ // const systemRepositoryMock = jest
45
+ // .spyOn(SystemRepository.prototype, 'findOne')
46
+ // .mockResolvedValueOnce({
47
+ // id: 175,
48
+ // } as any);
49
+
50
+ // jest.mock(
51
+ // '@tomei/mailer/privileges.json',
52
+ // () => {
53
+ // privilegeCalled++;
54
+ // return {
55
+ // Privileges: [
56
+ // {
57
+ // Code: 'Privilege1',
58
+ // Description: 'This is Privilege1',
59
+ // },
60
+ // ],
61
+ // };
62
+ // },
63
+ // );
64
+
65
+ // jest.mock(
66
+ // '@tomei/config/privileges.json',
67
+ // () => {
68
+ // privilegeCalled++;
69
+ // return {
70
+ // Privileges: [
71
+ // {
72
+ // Code: 'Privilege2',
73
+ // Description: 'This is Privilege2',
74
+ // },
75
+ // ],
76
+ // };
77
+ // },
78
+ // );
79
+
80
+ // await Privilege.loadPrivileges(['mailer', 'config'], 'EZC');
81
+ // expect(findOrCreateMock).toBeCalledTimes(2);
82
+ // expect(systemRepositoryMock).toBeCalledTimes(1);
83
+ // expect(privilegeCalled).toEqual(2);
84
+ // });
85
+ // });
86
+
87
+ describe('SystemPrivilege', () => {
88
+ it('should be true', () => {
89
+ expect(true).toBe(true);
90
+ });
91
+ });
@@ -0,0 +1,237 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
3
+ <coverage lines-valid="78" lines-covered="49" line-rate="0.6282" branches-valid="22" branches-covered="13" branch-rate="0.5909" timestamp="1785821349520" complexity="0" version="0.1">
4
+ <sources>
5
+ <source>C:\Users\Diaz\Master\Workplaces\Projects\tomei-projects\sso</source>
6
+ </sources>
7
+ <packages>
8
+ <package name="components.password-hash" line-rate="1" branch-rate="1">
9
+ <classes>
10
+ <class name="password-hash.service.ts" filename="src\components\password-hash\password-hash.service.ts" line-rate="1" branch-rate="1">
11
+ <methods>
12
+ <method name="(anonymous_7)" hits="1" signature="()V">
13
+ <lines>
14
+ <line number="5" hits="1"/>
15
+ </lines>
16
+ </method>
17
+ <method name="(anonymous_8)" hits="1" signature="()V">
18
+ <lines>
19
+ <line number="7" hits="1"/>
20
+ </lines>
21
+ </method>
22
+ <method name="(anonymous_10)" hits="1" signature="()V">
23
+ <lines>
24
+ <line number="11" hits="1"/>
25
+ </lines>
26
+ </method>
27
+ </methods>
28
+ <lines>
29
+ <line number="1" hits="1" branch="false"/>
30
+ <line number="4" hits="1" branch="false"/>
31
+ <line number="8" hits="1" branch="false"/>
32
+ <line number="12" hits="1" branch="false"/>
33
+ </lines>
34
+ </class>
35
+ </classes>
36
+ </package>
37
+ <package name="redis-client" line-rate="0.6764" branch-rate="0.5454">
38
+ <classes>
39
+ <class name="redis.service.ts" filename="src\redis-client\redis.service.ts" line-rate="0.6764" branch-rate="0.5454">
40
+ <methods>
41
+ <method name="(anonymous_7)" hits="5" signature="()V">
42
+ <lines>
43
+ <line number="5" hits="5"/>
44
+ </lines>
45
+ </method>
46
+ <method name="(anonymous_8)" hits="5" signature="()V">
47
+ <lines>
48
+ <line number="7" hits="5"/>
49
+ </lines>
50
+ </method>
51
+ <method name="(anonymous_10)" hits="0" signature="()V">
52
+ <lines>
53
+ <line number="23" hits="0"/>
54
+ </lines>
55
+ </method>
56
+ <method name="(anonymous_11)" hits="0" signature="()V">
57
+ <lines>
58
+ <line number="26" hits="0"/>
59
+ </lines>
60
+ </method>
61
+ <method name="(anonymous_12)" hits="0" signature="()V">
62
+ <lines>
63
+ <line number="27" hits="0"/>
64
+ </lines>
65
+ </method>
66
+ <method name="(anonymous_13)" hits="4" signature="()V">
67
+ <lines>
68
+ <line number="39" hits="4"/>
69
+ </lines>
70
+ </method>
71
+ <method name="(anonymous_14)" hits="4" signature="()V">
72
+ <lines>
73
+ <line number="40" hits="4"/>
74
+ </lines>
75
+ </method>
76
+ <method name="(anonymous_15)" hits="3" signature="()V">
77
+ <lines>
78
+ <line number="52" hits="3"/>
79
+ </lines>
80
+ </method>
81
+ <method name="(anonymous_17)" hits="0" signature="()V">
82
+ <lines>
83
+ <line number="60" hits="0"/>
84
+ </lines>
85
+ </method>
86
+ <method name="(anonymous_19)" hits="0" signature="()V">
87
+ <lines>
88
+ <line number="68" hits="0"/>
89
+ </lines>
90
+ </method>
91
+ </methods>
92
+ <lines>
93
+ <line number="1" hits="2" branch="false"/>
94
+ <line number="2" hits="2" branch="false"/>
95
+ <line number="8" hits="5" branch="true" condition-coverage="50% (1/2)"/>
96
+ <line number="9" hits="5" branch="true" condition-coverage="100% (2/2)"/>
97
+ <line number="11" hits="2" branch="false"/>
98
+ <line number="12" hits="2" branch="false"/>
99
+ <line number="13" hits="2" branch="false"/>
100
+ <line number="14" hits="2" branch="false"/>
101
+ <line number="15" hits="2" branch="true" condition-coverage="50% (1/2)"/>
102
+ <line number="16" hits="2" branch="true" condition-coverage="50% (1/2)"/>
103
+ <line number="17" hits="2" branch="false"/>
104
+ <line number="18" hits="2" branch="false"/>
105
+ <line number="23" hits="2" branch="false"/>
106
+ <line number="24" hits="0" branch="false"/>
107
+ <line number="26" hits="2" branch="false"/>
108
+ <line number="27" hits="2" branch="false"/>
109
+ <line number="28" hits="0" branch="false"/>
110
+ <line number="31" hits="2" branch="false"/>
111
+ <line number="34" hits="0" branch="false"/>
112
+ <line number="36" hits="5" branch="false"/>
113
+ <line number="40" hits="4" branch="false"/>
114
+ <line number="44" hits="4" branch="false"/>
115
+ <line number="45" hits="4" branch="true" condition-coverage="50% (1/2)"/>
116
+ <line number="46" hits="4" branch="false"/>
117
+ <line number="48" hits="0" branch="false"/>
118
+ <line number="53" hits="3" branch="false"/>
119
+ <line number="54" hits="3" branch="false"/>
120
+ <line number="56" hits="0" branch="false"/>
121
+ <line number="61" hits="0" branch="false"/>
122
+ <line number="62" hits="0" branch="false"/>
123
+ <line number="64" hits="0" branch="false"/>
124
+ <line number="69" hits="0" branch="false"/>
125
+ <line number="70" hits="0" branch="false"/>
126
+ <line number="72" hits="0" branch="false"/>
127
+ </lines>
128
+ </class>
129
+ </classes>
130
+ </package>
131
+ <package name="session" line-rate="0.55" branch-rate="0.6363">
132
+ <classes>
133
+ <class name="session.service.ts" filename="src\session\session.service.ts" line-rate="0.55" branch-rate="0.6363">
134
+ <methods>
135
+ <method name="(anonymous_7)" hits="3" signature="()V">
136
+ <lines>
137
+ <line number="9" hits="3"/>
138
+ </lines>
139
+ </method>
140
+ <method name="(anonymous_8)" hits="3" signature="()V">
141
+ <lines>
142
+ <line number="11" hits="3"/>
143
+ </lines>
144
+ </method>
145
+ <method name="(anonymous_10)" hits="3" signature="()V">
146
+ <lines>
147
+ <line number="22" hits="3"/>
148
+ </lines>
149
+ </method>
150
+ <method name="(anonymous_11)" hits="3" signature="()V">
151
+ <lines>
152
+ <line number="23" hits="3"/>
153
+ </lines>
154
+ </method>
155
+ <method name="(anonymous_12)" hits="2" signature="()V">
156
+ <lines>
157
+ <line number="36" hits="2"/>
158
+ </lines>
159
+ </method>
160
+ <method name="(anonymous_13)" hits="2" signature="()V">
161
+ <lines>
162
+ <line number="37" hits="2"/>
163
+ </lines>
164
+ </method>
165
+ <method name="(anonymous_14)" hits="1" signature="()V">
166
+ <lines>
167
+ <line number="53" hits="1"/>
168
+ </lines>
169
+ </method>
170
+ <method name="(anonymous_15)" hits="1" signature="()V">
171
+ <lines>
172
+ <line number="54" hits="1"/>
173
+ </lines>
174
+ </method>
175
+ <method name="(anonymous_16)" hits="0" signature="()V">
176
+ <lines>
177
+ <line number="66" hits="0"/>
178
+ </lines>
179
+ </method>
180
+ <method name="(anonymous_18)" hits="0" signature="()V">
181
+ <lines>
182
+ <line number="79" hits="0"/>
183
+ </lines>
184
+ </method>
185
+ <method name="(anonymous_20)" hits="0" signature="()V">
186
+ <lines>
187
+ <line number="88" hits="0"/>
188
+ </lines>
189
+ </method>
190
+ </methods>
191
+ <lines>
192
+ <line number="1" hits="1" branch="false"/>
193
+ <line number="5" hits="1" branch="false"/>
194
+ <line number="7" hits="3" branch="false"/>
195
+ <line number="12" hits="3" branch="false"/>
196
+ <line number="13" hits="3" branch="false"/>
197
+ <line number="14" hits="3" branch="true" condition-coverage="50% (1/2)"/>
198
+ <line number="15" hits="3" branch="false"/>
199
+ <line number="16" hits="0" branch="true" condition-coverage="0% (0/2)"/>
200
+ <line number="17" hits="0" branch="false"/>
201
+ <line number="19" hits="3" branch="false"/>
202
+ <line number="23" hits="3" branch="false"/>
203
+ <line number="28" hits="3" branch="false"/>
204
+ <line number="29" hits="3" branch="false"/>
205
+ <line number="30" hits="3" branch="false"/>
206
+ <line number="32" hits="0" branch="false"/>
207
+ <line number="37" hits="2" branch="false"/>
208
+ <line number="40" hits="2" branch="false"/>
209
+ <line number="41" hits="2" branch="false"/>
210
+ <line number="42" hits="2" branch="false"/>
211
+ <line number="43" hits="2" branch="true" condition-coverage="50% (1/2)"/>
212
+ <line number="44" hits="0" branch="false"/>
213
+ <line number="47" hits="2" branch="false"/>
214
+ <line number="49" hits="0" branch="false"/>
215
+ <line number="54" hits="1" branch="false"/>
216
+ <line number="58" hits="1" branch="false"/>
217
+ <line number="59" hits="1" branch="false"/>
218
+ <line number="60" hits="1" branch="false"/>
219
+ <line number="62" hits="0" branch="false"/>
220
+ <line number="71" hits="0" branch="false"/>
221
+ <line number="72" hits="0" branch="false"/>
222
+ <line number="73" hits="0" branch="false"/>
223
+ <line number="75" hits="0" branch="false"/>
224
+ <line number="80" hits="0" branch="false"/>
225
+ <line number="81" hits="0" branch="false"/>
226
+ <line number="82" hits="0" branch="false"/>
227
+ <line number="84" hits="0" branch="false"/>
228
+ <line number="89" hits="0" branch="false"/>
229
+ <line number="90" hits="0" branch="false"/>
230
+ <line number="91" hits="0" branch="false"/>
231
+ <line number="93" hits="0" branch="false"/>
232
+ </lines>
233
+ </class>
234
+ </classes>
235
+ </package>
236
+ </packages>
237
+ </coverage>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testExecutions version="1">
3
+ <file path="C:\Users\Diaz\Master\Workplaces\Projects\tomei-projects\sso\__tests__\unit\components\login-user\login.spec.ts">
4
+ <testCase name="LoginUser init should initialize LoginUser with valid userId" duration="134"/>
5
+ <testCase name="LoginUser init should throw an error when user is not found" duration="39"/>
6
+ <testCase name="LoginUser shouldReleaseLock should return true if autoReleaseYN is &quot;Y&quot; and time difference is greater than minuteToAutoRelease" duration="3"/>
7
+ <testCase name="LoginUser shouldReleaseLock should return false if autoReleaseYN is &quot;Y&quot; and time difference is less than or equal to minuteToAutoRelease" duration="2"/>
8
+ <testCase name="LoginUser shouldReleaseLock should return false if autoReleaseYN is &quot;N&quot;" duration="2"/>
9
+ <testCase name="LoginUser releaseLock should release the lock for a user" duration="2"/>
10
+ <testCase name="LoginUser checkUserInfoDuplicated should throw an error if duplicate user info is found" duration="109"/>
11
+ <testCase name="LoginUser checkUserInfoDuplicated should not throw an error if duplicate user info is not found" duration="1"/>
12
+ <testCase name="LoginUser generateDefaultPassword should generate a default password with the specified length" duration="3"/>
13
+ <testCase name="LoginUser generateDefaultPassword should generate a default password with at least one capital letter" duration="1"/>
14
+ <testCase name="LoginUser generateDefaultPassword should generate a default password with at least one number" duration="1"/>
15
+ <testCase name="LoginUser generateDefaultPassword should generate a default password with at least one special character" duration="1"/>
16
+ <testCase name="LoginUser generateDefaultPassword should generate a default password without any non-acceptable characters" duration="1"/>
17
+ <testCase name="LoginUser setPassword should set the password for the user" duration="312"/>
18
+ <testCase name="LoginUser setPassword should throw an error if the password does not meet the security requirements" duration="48"/>
19
+ <testCase name="LoginUser incrementFailedLoginAttemptCount should increment FailedLoginAttemptCount and update user status" duration="8"/>
20
+ <testCase name="LoginUser incrementFailedLoginAttemptCount should throw an error if maxFailedLoginAttempts or autoReleaseYN is missing" duration="6"/>
21
+ <testCase name="LoginUser incrementFailedLoginAttemptCount should lock the user account if the failed login attempts exceed the maximum allowed" duration="5"/>
22
+ <testCase name="LoginUser incrementFailedLoginAttemptCount should permanently lock the user account if the failed login attempts exceed the maximum allowed and autoReleaseYN is N" duration="7"/>
23
+ <testCase name="LoginUser combineSystemAccess should combine user and group system access and remove duplicates" duration="5"/>
24
+ <testCase name="LoginUser checkPrivileges should return true if user has the specified privilege" duration="10"/>
25
+ <testCase name="LoginUser checkPrivileges should return false if user does not have the specified privilege" duration="5"/>
26
+ <testCase name="LoginUser checkPrivileges should throw an error if ObjectId is not set" duration="9"/>
27
+ <testCase name="LoginUser getObjectPrivileges should return an array of privileges" duration="5"/>
28
+ <testCase name="LoginUser getObjectPrivileges should throw an error if an exception occurs" duration="8"/>
29
+ <testCase name="LoginUser getUserPersonalPrivileges should return an array of privileges" duration="4"/>
30
+ <testCase name="LoginUser getUserPersonalPrivileges should throw an error if an error occurs" duration="4"/>
31
+ <testCase name="LoginUser getInheritedSystemAccess should return group system access with its parent group system access if applicable" duration="32"/>
32
+ </file>
33
+ </testExecutions>
@@ -1,40 +1,40 @@
1
-
2
- -- example to create sso-user
3
- CREATE USER 'sso_user'@'environment' IDENTIFIED BY 'password';
4
-
5
- -- example to grant neccesary access to run migration
6
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_authorization_codes TO 'sso_user'@'localhost' WITH GRANT OPTION;
7
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_bearer_tokens TO 'sso_user'@'localhost' WITH GRANT OPTION;
8
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_building_types TO 'sso_user'@'localhost' WITH GRANT OPTION;
9
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_buildings TO 'sso_user'@'localhost' WITH GRANT OPTION;
10
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_cities TO 'sso_user'@'localhost' WITH GRANT OPTION;
11
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_companies TO 'sso_user'@'localhost' WITH GRANT OPTION;
12
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_countries TO 'sso_user'@'localhost' WITH GRANT OPTION;
13
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_departments TO 'sso_user'@'localhost' WITH GRANT OPTION;
14
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_grouproleprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
15
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemaccess TO 'sso_user'@'localhost' WITH GRANT OPTION;
16
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
17
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
18
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_oauth_tokens TO 'sso_user'@'localhost' WITH GRANT OPTION;
19
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_roles TO 'sso_user'@'localhost' WITH GRANT OPTION;
20
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_sequelize_meta TO 'sso_user'@'localhost' WITH GRANT OPTION;
21
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_staff_types TO 'sso_user'@'localhost' WITH GRANT OPTION;
22
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_staffs TO 'sso_user'@'localhost' WITH GRANT OPTION;
23
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_states TO 'sso_user'@'localhost' WITH GRANT OPTION;
24
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_system_accesses TO 'sso_user'@'localhost' WITH GRANT OPTION;
25
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
26
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
27
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemroleprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
28
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systems TO 'sso_user'@'localhost' WITH GRANT OPTION;
29
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_updated_history TO 'sso_user'@'localhost' WITH GRANT OPTION;
30
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_user_roles TO 'sso_user'@'localhost' WITH GRANT OPTION;
31
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usergroup TO 'sso_user'@'localhost' WITH GRANT OPTION;
32
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_users TO 'sso_user'@'localhost' WITH GRANT OPTION;
33
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
34
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
35
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_UserUserGroup TO 'sso_user'@'localhost' WITH GRANT OPTION;
36
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production._prisma_migrations TO 'sso_user'@'localhost' WITH GRANT OPTION;
37
-
38
-
39
- -- Grant user to create, alter, drop, references on the database (required for creating shadow tables)
1
+
2
+ -- example to create sso-user
3
+ CREATE USER 'sso_user'@'environment' IDENTIFIED BY 'password';
4
+
5
+ -- example to grant neccesary access to run migration
6
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_authorization_codes TO 'sso_user'@'localhost' WITH GRANT OPTION;
7
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_bearer_tokens TO 'sso_user'@'localhost' WITH GRANT OPTION;
8
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_building_types TO 'sso_user'@'localhost' WITH GRANT OPTION;
9
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_buildings TO 'sso_user'@'localhost' WITH GRANT OPTION;
10
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_cities TO 'sso_user'@'localhost' WITH GRANT OPTION;
11
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_companies TO 'sso_user'@'localhost' WITH GRANT OPTION;
12
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_countries TO 'sso_user'@'localhost' WITH GRANT OPTION;
13
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_departments TO 'sso_user'@'localhost' WITH GRANT OPTION;
14
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_grouproleprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
15
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemaccess TO 'sso_user'@'localhost' WITH GRANT OPTION;
16
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
17
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_groupsystemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
18
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_oauth_tokens TO 'sso_user'@'localhost' WITH GRANT OPTION;
19
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_roles TO 'sso_user'@'localhost' WITH GRANT OPTION;
20
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_sequelize_meta TO 'sso_user'@'localhost' WITH GRANT OPTION;
21
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_staff_types TO 'sso_user'@'localhost' WITH GRANT OPTION;
22
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_staffs TO 'sso_user'@'localhost' WITH GRANT OPTION;
23
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_states TO 'sso_user'@'localhost' WITH GRANT OPTION;
24
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_system_accesses TO 'sso_user'@'localhost' WITH GRANT OPTION;
25
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
26
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
27
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systemroleprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
28
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_systems TO 'sso_user'@'localhost' WITH GRANT OPTION;
29
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_updated_history TO 'sso_user'@'localhost' WITH GRANT OPTION;
30
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_user_roles TO 'sso_user'@'localhost' WITH GRANT OPTION;
31
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usergroup TO 'sso_user'@'localhost' WITH GRANT OPTION;
32
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_users TO 'sso_user'@'localhost' WITH GRANT OPTION;
33
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
34
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
35
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_UserUserGroup TO 'sso_user'@'localhost' WITH GRANT OPTION;
36
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production._prisma_migrations TO 'sso_user'@'localhost' WITH GRANT OPTION;
37
+
38
+
39
+ -- Grant user to create, alter, drop, references on the database (required for creating shadow tables)
40
40
  GRANT CREATE, ALTER, DROP, REFERENCES ON shadow_database.* TO 'sso_user'@'localhost' WITH GRANT OPTION;