@tomei/sso 0.60.4-dev.11 → 0.60.4-dev.13

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 (147) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.gitlab-ci.yml +16 -16
  3. package/.husky/commit-msg +9 -9
  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/group/group.spec.ts +79 -79
  9. package/__tests__/unit/components/group-object-privilege/group-object-privilege.spec.ts +88 -88
  10. package/__tests__/unit/components/group-privilege/group-privilege.spec.ts +68 -68
  11. package/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.ts +66 -66
  12. package/__tests__/unit/components/group-system-access/group-system-access.spec.ts +83 -83
  13. package/__tests__/unit/components/login-user/l.spec.ts +746 -746
  14. package/__tests__/unit/components/login-user/login.spec.ts +1164 -1164
  15. package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
  16. package/__tests__/unit/components/system/system.spec.ts +254 -254
  17. package/__tests__/unit/components/system-privilege/system-privilege.spec.ts +83 -83
  18. package/__tests__/unit/components/user-group/user-group.spec.ts +86 -86
  19. package/__tests__/unit/components/user-object-privilege/user-object-privilege.spec.ts +78 -78
  20. package/__tests__/unit/components/user-privilege/user-privilege.spec.ts +72 -72
  21. package/__tests__/unit/components/user-system-access/user-system-access.spec.ts +89 -89
  22. package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
  23. package/__tests__/unit/session/session.service.spec.ts +47 -47
  24. package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
  25. package/coverage/clover.xml +1452 -1452
  26. package/coverage/coverage-final.json +47 -47
  27. package/coverage/lcov-report/base.css +224 -224
  28. package/coverage/lcov-report/block-navigation.js +87 -87
  29. package/coverage/lcov-report/components/group/group.repository.ts.html +117 -117
  30. package/coverage/lcov-report/components/group/group.ts.html +327 -327
  31. package/coverage/lcov-report/components/group/index.html +130 -130
  32. package/coverage/lcov-report/components/group-object-privilege/group-object-privilege.repository.ts.html +117 -117
  33. package/coverage/lcov-report/components/group-object-privilege/group-object-privilege.ts.html +321 -321
  34. package/coverage/lcov-report/components/group-object-privilege/index.html +130 -130
  35. package/coverage/lcov-report/components/group-privilege/group-privilege.repository.ts.html +117 -117
  36. package/coverage/lcov-report/components/group-privilege/group-privilege.ts.html +303 -303
  37. package/coverage/lcov-report/components/group-privilege/index.html +130 -130
  38. package/coverage/lcov-report/components/group-reporting-user/group-reporting-user.repository.ts.html +117 -117
  39. package/coverage/lcov-report/components/group-reporting-user/group-reporting-user.ts.html +327 -327
  40. package/coverage/lcov-report/components/group-reporting-user/index.html +130 -130
  41. package/coverage/lcov-report/components/group-system-access/group-system-access.repository.ts.html +117 -117
  42. package/coverage/lcov-report/components/group-system-access/group-system-access.ts.html +309 -309
  43. package/coverage/lcov-report/components/group-system-access/index.html +130 -130
  44. package/coverage/lcov-report/components/login-history/index.html +115 -115
  45. package/coverage/lcov-report/components/login-history/login-history.repository.ts.html +117 -117
  46. package/coverage/lcov-report/components/login-user/index.html +130 -130
  47. package/coverage/lcov-report/components/login-user/login-user.ts.html +5014 -5014
  48. package/coverage/lcov-report/components/login-user/user.repository.ts.html +117 -117
  49. package/coverage/lcov-report/components/password-hash/index.html +115 -115
  50. package/coverage/lcov-report/components/password-hash/password-hash.service.ts.html +126 -126
  51. package/coverage/lcov-report/components/system/index.html +130 -130
  52. package/coverage/lcov-report/components/system/system.repository.ts.html +117 -117
  53. package/coverage/lcov-report/components/system/system.ts.html +909 -909
  54. package/coverage/lcov-report/components/system-privilege/index.html +130 -130
  55. package/coverage/lcov-report/components/system-privilege/system-privilege.repository.ts.html +120 -120
  56. package/coverage/lcov-report/components/system-privilege/system-privilege.ts.html +390 -390
  57. package/coverage/lcov-report/components/user-group/index.html +130 -130
  58. package/coverage/lcov-report/components/user-group/user-group.repository.ts.html +117 -117
  59. package/coverage/lcov-report/components/user-group/user-group.ts.html +354 -354
  60. package/coverage/lcov-report/components/user-object-privilege/index.html +130 -130
  61. package/coverage/lcov-report/components/user-object-privilege/user-object-privilege.repository.ts.html +117 -117
  62. package/coverage/lcov-report/components/user-object-privilege/user-object-privilege.ts.html +312 -312
  63. package/coverage/lcov-report/components/user-privilege/index.html +130 -130
  64. package/coverage/lcov-report/components/user-privilege/user-privilege.repository.ts.html +117 -117
  65. package/coverage/lcov-report/components/user-privilege/user-privilege.ts.html +306 -306
  66. package/coverage/lcov-report/components/user-system-access/index.html +130 -130
  67. package/coverage/lcov-report/components/user-system-access/user-system-access.repository.ts.html +117 -117
  68. package/coverage/lcov-report/components/user-system-access/user-system-access.ts.html +312 -312
  69. package/coverage/lcov-report/enum/group-type.enum.ts.html +108 -108
  70. package/coverage/lcov-report/enum/index.html +160 -160
  71. package/coverage/lcov-report/enum/index.ts.html +93 -93
  72. package/coverage/lcov-report/enum/user-status.enum.ts.html +105 -105
  73. package/coverage/lcov-report/enum/yn.enum.ts.html +96 -96
  74. package/coverage/lcov-report/index.html +370 -370
  75. package/coverage/lcov-report/models/group-object-privilege.entity.ts.html +333 -333
  76. package/coverage/lcov-report/models/group-privilege.entity.ts.html +315 -315
  77. package/coverage/lcov-report/models/group-reporting-user.entity.ts.html +339 -339
  78. package/coverage/lcov-report/models/group-system-access.entity.ts.html +324 -324
  79. package/coverage/lcov-report/models/group.entity.ts.html +435 -435
  80. package/coverage/lcov-report/models/index.html +310 -310
  81. package/coverage/lcov-report/models/login-history.entity.ts.html +252 -252
  82. package/coverage/lcov-report/models/staff.entity.ts.html +411 -411
  83. package/coverage/lcov-report/models/system-privilege.entity.ts.html +354 -354
  84. package/coverage/lcov-report/models/system.entity.ts.html +423 -423
  85. package/coverage/lcov-report/models/user-group.entity.ts.html +354 -354
  86. package/coverage/lcov-report/models/user-object-privilege.entity.ts.html +330 -330
  87. package/coverage/lcov-report/models/user-privilege.entity.ts.html +315 -315
  88. package/coverage/lcov-report/models/user-system-access.entity.ts.html +315 -315
  89. package/coverage/lcov-report/models/user.entity.ts.html +522 -522
  90. package/coverage/lcov-report/prettify.css +1 -1
  91. package/coverage/lcov-report/prettify.js +2 -2
  92. package/coverage/lcov-report/redis-client/index.html +115 -115
  93. package/coverage/lcov-report/redis-client/redis.service.ts.html +240 -240
  94. package/coverage/lcov-report/session/index.html +115 -115
  95. package/coverage/lcov-report/session/session.service.ts.html +246 -246
  96. package/coverage/lcov-report/sorter.js +196 -196
  97. package/coverage/lcov.info +2490 -2490
  98. package/coverage/test-report.xml +128 -128
  99. package/create-sso-user.sql +39 -39
  100. package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +1 -0
  101. package/dist/src/components/login-user/login-user.js +1 -0
  102. package/dist/src/components/login-user/login-user.js.map +1 -1
  103. package/dist/src/components/login-user/user.d.ts +3 -0
  104. package/dist/src/components/login-user/user.js +27 -0
  105. package/dist/src/components/login-user/user.js.map +1 -1
  106. package/dist/src/models/user.entity.d.ts +1 -0
  107. package/dist/src/models/user.entity.js +7 -0
  108. package/dist/src/models/user.entity.js.map +1 -1
  109. package/dist/tsconfig.tsbuildinfo +1 -1
  110. package/eslint.config.mjs +58 -58
  111. package/jest.config.js +14 -14
  112. package/migrations/20240314080602-create-user-table.js +124 -124
  113. package/migrations/20240314080603-create-user-group-table.js +85 -85
  114. package/migrations/20240314080604-create-user-user-group-table.js +55 -55
  115. package/migrations/20240314080605-create-login-history-table.js +53 -53
  116. package/migrations/20240527064925-create-system-table.js +78 -78
  117. package/migrations/20240527064926-create-system-privilege-table.js +71 -71
  118. package/migrations/20240527065342-create-group-table.js +93 -93
  119. package/migrations/20240527065633-create-group-reporting-user-table.js +76 -76
  120. package/migrations/20240528011551-create-group-system-access-table.js +72 -72
  121. package/migrations/20240528023018-user-system-access-table.js +75 -75
  122. package/migrations/20240528032229-user-privilege-table.js +76 -76
  123. package/migrations/20240528063003-create-group-privilege-table.js +76 -76
  124. package/migrations/20240528063051-create-group-object-privilege-table.js +84 -84
  125. package/migrations/20240528063107-create-user-object-privilege-table.js +84 -84
  126. package/migrations/20240528063108-create-api-key-table.js +85 -85
  127. package/migrations/20241104104802-create-building-table.js +95 -95
  128. package/migrations/20250108091132-add-area-manager-user-id-to-building-table.js +14 -14
  129. package/migrations/20250108091133-add-passcode-to-user-table.js +36 -36
  130. package/migrations/20250210115636-create-user-reporting-hierarchy.js +76 -76
  131. package/migrations/20250326043818-crate-user-password-history.js +42 -42
  132. package/migrations/20250610070720-added-MFBypassYN-to-sso-user.js +30 -30
  133. package/migrations/20250805085707-add-bulk-approval-code-to-sso-user.js +29 -0
  134. package/package.json +90 -90
  135. package/sampledotenv +7 -7
  136. package/src/components/login-user/interfaces/user-info.interface.ts +1 -0
  137. package/src/components/login-user/login-user.ts +1 -0
  138. package/src/components/login-user/user.ts +30 -0
  139. package/src/models/user.entity.ts +6 -0
  140. package/tsconfig.build.json +5 -5
  141. package/tsconfig.json +23 -23
  142. package/dist/__tests__/unit/components/group-privilege/group-privilege.test.d.ts +0 -1
  143. package/dist/__tests__/unit/components/group-privilege/group-privilege.test.js +0 -71
  144. package/dist/__tests__/unit/components/group-privilege/group-privilege.test.js.map +0 -1
  145. package/dist/__tests__/unit/components/login-user/login-user.spec.d.ts +0 -0
  146. package/dist/__tests__/unit/components/login-user/login-user.spec.js +0 -6
  147. package/dist/__tests__/unit/components/login-user/login-user.spec.js.map +0 -1
package/package.json CHANGED
@@ -1,90 +1,90 @@
1
- {
2
- "name": "@tomei/sso",
3
- "version": "0.60.4-dev.11",
4
- "description": "Tomei SSO Package",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "start:dev": "tsc -w",
8
- "build": "tsc",
9
- "prepare": "husky install",
10
- "format": "prettier --write \"src/**/*.ts\"",
11
- "lint": "npx eslint . --fix",
12
- "test": "jest --forceExit --detectOpenHandles --coverage"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
17
- },
18
- "keywords": [
19
- "tomei",
20
- "sso"
21
- ],
22
- "author": "Tomei",
23
- "license": "ISC",
24
- "bugs": {
25
- "url": "https://gitlab.com/tomei-package/sso/issues"
26
- },
27
- "homepage": "https://gitlab.com/tomei-package/sso#readme",
28
- "devDependencies": {
29
- "@commitlint/cli": "^19.6.0",
30
- "@commitlint/config-conventional": "^19.6.0",
31
- "@eslint/js": "^9.15.0",
32
- "@tsconfig/node18": "^18.2.4",
33
- "@types/bcrypt": "^5.0.2",
34
- "@types/jest": "^29.5.14",
35
- "@types/node": "^22.9.3",
36
- "@types/redis": "^4.0.11",
37
- "@types/validator": "^13.12.2",
38
- "@typescript-eslint/eslint-plugin": "^8.15.0",
39
- "@typescript-eslint/parser": "^8.15.0",
40
- "cls-hooked": "^4.2.2",
41
- "dotenv": "^16.4.5",
42
- "eslint": "^9.15.0",
43
- "eslint-config-prettier": "^9.1.0",
44
- "eslint-plugin-import": "^2.31.0",
45
- "eslint-plugin-prettier": "^5.2.1",
46
- "globals": "^15.12.0",
47
- "husky": "^9.1.7",
48
- "jest": "^29.7.0",
49
- "jest-mock-extended": "^3.0.7",
50
- "jest-sonar-reporter": "^2.0.0",
51
- "lint-staged": "^15.2.10",
52
- "prettier": "^3.3.3",
53
- "redis-mock": "^0.56.3",
54
- "ts-jest": "^29.2.5",
55
- "ts-node": "^10.9.2",
56
- "tsc-watch": "^6.2.1",
57
- "tsconfig-paths": "^4.2.0",
58
- "tslint": "^6.1.3",
59
- "typescript": "^5.7.2",
60
- "typescript-eslint": "^8.15.0"
61
- },
62
- "publishConfig": {
63
- "access": "public"
64
- },
65
- "peerDependencies": {
66
- "@tomei/activity-history": "^0.4.0",
67
- "@tomei/config": "^0.3.21",
68
- "@tomei/general": "^0.21.3",
69
- "@tomei/mailer": "^0.5.21",
70
- "argon2": "^0.41.1",
71
- "redis": "^4.7.0",
72
- "reflect-metadata": "^0.2.2",
73
- "sequelize": "^6.37.5",
74
- "sequelize-cli": "^6.6.2",
75
- "sequelize-typescript": "^2.1.6",
76
- "speakeasy": "^2.0.0",
77
- "uuid": "^11.0.3"
78
- },
79
- "lint-staged": {
80
- "*/**/*.{js,ts,tsx}": [
81
- "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
82
- "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
83
- ]
84
- },
85
- "jestSonar": {
86
- "reportPath": "coverage",
87
- "reportFile": "test-report.xml",
88
- "indent": 2
89
- }
90
- }
1
+ {
2
+ "name": "@tomei/sso",
3
+ "version": "0.60.4-dev.13",
4
+ "description": "Tomei SSO Package",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "start:dev": "tsc -w",
8
+ "build": "tsc",
9
+ "prepare": "husky install",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
+ "lint": "npx eslint . --fix",
12
+ "test": "jest --forceExit --detectOpenHandles --coverage"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
17
+ },
18
+ "keywords": [
19
+ "tomei",
20
+ "sso"
21
+ ],
22
+ "author": "Tomei",
23
+ "license": "ISC",
24
+ "bugs": {
25
+ "url": "https://gitlab.com/tomei-package/sso/issues"
26
+ },
27
+ "homepage": "https://gitlab.com/tomei-package/sso#readme",
28
+ "devDependencies": {
29
+ "@commitlint/cli": "^19.6.0",
30
+ "@commitlint/config-conventional": "^19.6.0",
31
+ "@eslint/js": "^9.15.0",
32
+ "@tsconfig/node18": "^18.2.4",
33
+ "@types/bcrypt": "^5.0.2",
34
+ "@types/jest": "^29.5.14",
35
+ "@types/node": "^22.9.3",
36
+ "@types/redis": "^4.0.11",
37
+ "@types/validator": "^13.12.2",
38
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
39
+ "@typescript-eslint/parser": "^8.15.0",
40
+ "cls-hooked": "^4.2.2",
41
+ "dotenv": "^16.4.5",
42
+ "eslint": "^9.15.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-plugin-import": "^2.31.0",
45
+ "eslint-plugin-prettier": "^5.2.1",
46
+ "globals": "^15.12.0",
47
+ "husky": "^9.1.7",
48
+ "jest": "^29.7.0",
49
+ "jest-mock-extended": "^3.0.7",
50
+ "jest-sonar-reporter": "^2.0.0",
51
+ "lint-staged": "^15.2.10",
52
+ "prettier": "^3.3.3",
53
+ "redis-mock": "^0.56.3",
54
+ "ts-jest": "^29.2.5",
55
+ "ts-node": "^10.9.2",
56
+ "tsc-watch": "^6.2.1",
57
+ "tsconfig-paths": "^4.2.0",
58
+ "tslint": "^6.1.3",
59
+ "typescript": "^5.7.2",
60
+ "typescript-eslint": "^8.15.0"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "peerDependencies": {
66
+ "@tomei/activity-history": "^0.4.0",
67
+ "@tomei/config": "^0.3.21",
68
+ "@tomei/general": "^0.21.3",
69
+ "@tomei/mailer": "^0.5.21",
70
+ "argon2": "^0.41.1",
71
+ "redis": "^4.7.0",
72
+ "reflect-metadata": "^0.2.2",
73
+ "sequelize": "^6.37.5",
74
+ "sequelize-cli": "^6.6.2",
75
+ "sequelize-typescript": "^2.1.6",
76
+ "speakeasy": "^2.0.0",
77
+ "uuid": "^11.0.3"
78
+ },
79
+ "lint-staged": {
80
+ "*/**/*.{js,ts,tsx}": [
81
+ "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
82
+ "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
83
+ ]
84
+ },
85
+ "jestSonar": {
86
+ "reportPath": "coverage",
87
+ "reportFile": "test-report.xml",
88
+ "indent": 2
89
+ }
90
+ }
package/sampledotenv CHANGED
@@ -1,8 +1,8 @@
1
- DATABASE_URL=
2
- SHADOW_DATABASE_URL=
3
- REDIS_URL=
4
- REDIS_PASSWORD=
5
- SMTP_HOST=
6
- SMTP_PORT=
7
- EMAIL_SENDER=
1
+ DATABASE_URL=
2
+ SHADOW_DATABASE_URL=
3
+ REDIS_URL=
4
+ REDIS_PASSWORD=
5
+ SMTP_HOST=
6
+ SMTP_PORT=
7
+ EMAIL_SENDER=
8
8
  EMAIL_PASSWORD=
@@ -21,6 +21,7 @@ export interface IUserAttr extends IUserInfo {
21
21
  MFAEnabled: number;
22
22
  MFAConfig: string;
23
23
  MFABypassYN: string;
24
+ BulkApprovalCode: string;
24
25
  RecoveryEmail: string;
25
26
  FailedLoginAttemptCount: number;
26
27
  LastFailedLoginAt: Date;
@@ -62,6 +62,7 @@ export class LoginUser extends User implements ILoginUser {
62
62
  MFAEnabled: user.MFAEnabled,
63
63
  MFAConfig: user.MFAConfig,
64
64
  MFABypassYN: user.MFABypassYN,
65
+ BulkApprovalCode: user.BulkApprovalCode,
65
66
  RecoveryEmail: user.RecoveryEmail,
66
67
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
67
68
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -50,6 +50,7 @@ export class User extends UserBase {
50
50
  private _MFAEnabled: number;
51
51
  private _MFAConfig: string;
52
52
  private _MFABypassYN: string;
53
+ private _BulkApprovalCode: string;
53
54
  private _RecoveryEmail: string;
54
55
  private _FailedLoginAttemptCount: number;
55
56
  private _LastFailedLoginAt: Date;
@@ -171,6 +172,14 @@ export class User extends UserBase {
171
172
  this._MFABypassYN = value;
172
173
  }
173
174
 
175
+ get BulkApprovalCode(): string {
176
+ return this._BulkApprovalCode;
177
+ }
178
+
179
+ private set BulkApprovalCode(value: string) {
180
+ this._BulkApprovalCode = value;
181
+ }
182
+
174
183
  get RecoveryEmail(): string {
175
184
  return this._RecoveryEmail;
176
185
  }
@@ -306,6 +315,7 @@ export class User extends UserBase {
306
315
  this.MFAEnabled = userInfo.MFAEnabled;
307
316
  this.MFAConfig = userInfo.MFAConfig;
308
317
  this.MFABypassYN = userInfo.MFABypassYN;
318
+ this.BulkApprovalCode = userInfo.BulkApprovalCode;
309
319
  this.RecoveryEmail = userInfo.RecoveryEmail;
310
320
  this.FailedLoginAttemptCount = userInfo.FailedLoginAttemptCount;
311
321
  this.LastFailedLoginAt = userInfo.LastFailedLoginAt;
@@ -363,6 +373,7 @@ export class User extends UserBase {
363
373
  MFAEnabled: user.MFAEnabled,
364
374
  MFAConfig: user.MFAConfig,
365
375
  MFABypassYN: user.MFABypassYN,
376
+ BulkApprovalCode: user.BulkApprovalCode,
366
377
  RecoveryEmail: user.RecoveryEmail,
367
378
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
368
379
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -428,6 +439,7 @@ export class User extends UserBase {
428
439
  MFAEnabled: user.MFAEnabled,
429
440
  MFAConfig: user.MFAConfig,
430
441
  MFABypassYN: user.MFABypassYN,
442
+ BulkApprovalCode: user.BulkApprovalCode,
431
443
  RecoveryEmail: user.RecoveryEmail,
432
444
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
433
445
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -523,6 +535,7 @@ export class User extends UserBase {
523
535
  MFAEnabled: user.MFAEnabled,
524
536
  MFAConfig: user.MFAConfig,
525
537
  MFABypassYN: user.MFABypassYN,
538
+ BulkApprovalCode: user.BulkApprovalCode,
526
539
  RecoveryEmail: user.RecoveryEmail,
527
540
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
528
541
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -1587,6 +1600,7 @@ export class User extends UserBase {
1587
1600
  MFAEnabled: null,
1588
1601
  MFAConfig: null,
1589
1602
  MFABypassYN: YN.No,
1603
+ BulkApprovalCode: null,
1590
1604
  RecoveryEmail: null,
1591
1605
  FailedLoginAttemptCount: 0,
1592
1606
  LastFailedLoginAt: null,
@@ -2653,6 +2667,7 @@ export class User extends UserBase {
2653
2667
  MFAEnabled: user.MFAEnabled,
2654
2668
  MFAConfig: user.MFAConfig,
2655
2669
  MFABypassYN: user.MFABypassYN,
2670
+ BulkApprovalCode: user.BulkApprovalCode,
2656
2671
  RecoveryEmail: user.RecoveryEmail,
2657
2672
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
2658
2673
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -2780,6 +2795,7 @@ export class User extends UserBase {
2780
2795
  MFAEnabled: user.MFAEnabled,
2781
2796
  MFAConfig: user.MFAConfig,
2782
2797
  MFABypassYN: user.MFABypassYN,
2798
+ BulkApprovalCode: user.BulkApprovalCode,
2783
2799
  RecoveryEmail: user.RecoveryEmail,
2784
2800
  FailedLoginAttemptCount: user.FailedLoginAttemptCount,
2785
2801
  LastFailedLoginAt: user.LastFailedLoginAt,
@@ -2844,6 +2860,7 @@ export class User extends UserBase {
2844
2860
  MFAEnabled: this.MFAEnabled,
2845
2861
  MFAConfig: this.MFAConfig,
2846
2862
  MFABypassYN: this.MFABypassYN,
2863
+ BulkApprovalCode: this.BulkApprovalCode,
2847
2864
  RecoveryEmail: this.RecoveryEmail,
2848
2865
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
2849
2866
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -2876,6 +2893,7 @@ export class User extends UserBase {
2876
2893
  MFAEnabled: this.MFAEnabled,
2877
2894
  MFAConfig: this.MFAConfig,
2878
2895
  MFABypassYN: this.MFABypassYN,
2896
+ BulkApprovalCode: this.BulkApprovalCode,
2879
2897
  RecoveryEmail: this.RecoveryEmail,
2880
2898
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
2881
2899
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -2967,6 +2985,7 @@ export class User extends UserBase {
2967
2985
  MFAEnabled: this.MFAEnabled,
2968
2986
  MFAConfig: this.MFAConfig,
2969
2987
  MFABypassYN: this.MFABypassYN,
2988
+ BulkApprovalCode: this.BulkApprovalCode,
2970
2989
  RecoveryEmail: this.RecoveryEmail,
2971
2990
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
2972
2991
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -2999,6 +3018,7 @@ export class User extends UserBase {
2999
3018
  MFAEnabled: this.MFAEnabled,
3000
3019
  MFAConfig: this.MFAConfig,
3001
3020
  MFABypassYN: this.MFABypassYN,
3021
+ BulkApprovalCode: this.BulkApprovalCode,
3002
3022
  RecoveryEmail: this.RecoveryEmail,
3003
3023
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3004
3024
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3232,6 +3252,7 @@ export class User extends UserBase {
3232
3252
  MFAEnabled: this.MFAEnabled,
3233
3253
  MFAConfig: this.MFAConfig,
3234
3254
  MFABypassYN: this.MFABypassYN,
3255
+ BulkApprovalCode: this.BulkApprovalCode,
3235
3256
  RecoveryEmail: this.RecoveryEmail,
3236
3257
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3237
3258
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3247,12 +3268,14 @@ export class User extends UserBase {
3247
3268
 
3248
3269
  // 3. Update user record
3249
3270
  this.MFABypassYN = YN.Yes;
3271
+ this.MFAEnabled = 0;
3250
3272
  this.UpdatedAt = new Date();
3251
3273
  this.UpdatedById = loginUser.UserId;
3252
3274
 
3253
3275
  await User._Repository.update(
3254
3276
  {
3255
3277
  MFABypassYN: this.MFABypassYN,
3278
+ MFAEnabled: this.MFAEnabled,
3256
3279
  UpdatedAt: this.UpdatedAt,
3257
3280
  UpdatedById: this.UpdatedById,
3258
3281
  },
@@ -3280,6 +3303,7 @@ export class User extends UserBase {
3280
3303
  MFAEnabled: this.MFAEnabled,
3281
3304
  MFAConfig: this.MFAConfig,
3282
3305
  MFABypassYN: this.MFABypassYN,
3306
+ BulkApprovalCode: this.BulkApprovalCode,
3283
3307
  RecoveryEmail: this.RecoveryEmail,
3284
3308
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3285
3309
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3352,6 +3376,7 @@ export class User extends UserBase {
3352
3376
  MFAEnabled: this.MFAEnabled,
3353
3377
  MFAConfig: this.MFAConfig,
3354
3378
  MFABypassYN: this.MFABypassYN,
3379
+ BulkApprovalCode: this.BulkApprovalCode,
3355
3380
  RecoveryEmail: this.RecoveryEmail,
3356
3381
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3357
3382
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3367,12 +3392,14 @@ export class User extends UserBase {
3367
3392
 
3368
3393
  // 3. Update user record
3369
3394
  this.MFABypassYN = YN.No;
3395
+ this.MFAEnabled = 0;
3370
3396
  this.UpdatedAt = new Date();
3371
3397
  this.UpdatedById = loginUser.UserId;
3372
3398
 
3373
3399
  await User._Repository.update(
3374
3400
  {
3375
3401
  MFABypassYN: this.MFABypassYN,
3402
+ MFAEnabled: this.MFAEnabled,
3376
3403
  UpdatedAt: this.UpdatedAt,
3377
3404
  UpdatedById: this.UpdatedById,
3378
3405
  },
@@ -3400,6 +3427,7 @@ export class User extends UserBase {
3400
3427
  MFAEnabled: this.MFAEnabled,
3401
3428
  MFAConfig: this.MFAConfig,
3402
3429
  MFABypassYN: this.MFABypassYN,
3430
+ BulkApprovalCode: this.BulkApprovalCode,
3403
3431
  RecoveryEmail: this.RecoveryEmail,
3404
3432
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3405
3433
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3472,6 +3500,7 @@ export class User extends UserBase {
3472
3500
  MFAEnabled: this.MFAEnabled,
3473
3501
  MFAConfig: this.MFAConfig,
3474
3502
  MFABypassYN: this.MFABypassYN,
3503
+ BulkApprovalCode: this.BulkApprovalCode,
3475
3504
  RecoveryEmail: this.RecoveryEmail,
3476
3505
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3477
3506
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -3522,6 +3551,7 @@ export class User extends UserBase {
3522
3551
  MFAEnabled: this.MFAEnabled,
3523
3552
  MFAConfig: this.MFAConfig,
3524
3553
  MFABypassYN: this.MFABypassYN,
3554
+ BulkApprovalCode: this.BulkApprovalCode,
3525
3555
  RecoveryEmail: this.RecoveryEmail,
3526
3556
  FailedLoginAttemptCount: this.FailedLoginAttemptCount,
3527
3557
  LastFailedLoginAt: this.LastFailedLoginAt,
@@ -95,6 +95,12 @@ export default class User extends Model {
95
95
  })
96
96
  MFABypassYN: YN;
97
97
 
98
+ @Column({
99
+ allowNull: true,
100
+ type: DataType.STRING(100),
101
+ })
102
+ BulkApprovalCode: string;
103
+
98
104
  @Column({
99
105
  type: DataType.DATE,
100
106
  })
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["**/*.ts"],
4
- "exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
5
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.ts"],
4
+ "exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
5
+ }
6
6
 
package/tsconfig.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "declaration": true,
5
- "removeComments": true,
6
- "emitDecoratorMetadata": true,
7
- "experimentalDecorators": true,
8
- "allowSyntheticDefaultImports": true,
9
- "moduleResolution": "node",
10
- "target": "es6",
11
- "sourceMap": true,
12
- "outDir": "./dist",
13
- "baseUrl": "./src",
14
- "rootDir": "./",
15
- "incremental": true,
16
- "skipLibCheck": true,
17
- "noImplicitAny": false,
18
- "strictBindCallApply": false,
19
- "forceConsistentCasingInFileNames": false,
20
- "noFallthroughCasesInSwitch": false,
21
- "strictNullChecks": false,
22
- },
23
- "exclude": ["node_modules", "dist"]
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "moduleResolution": "node",
10
+ "target": "es6",
11
+ "sourceMap": true,
12
+ "outDir": "./dist",
13
+ "baseUrl": "./src",
14
+ "rootDir": "./",
15
+ "incremental": true,
16
+ "skipLibCheck": true,
17
+ "noImplicitAny": false,
18
+ "strictBindCallApply": false,
19
+ "forceConsistentCasingInFileNames": false,
20
+ "noFallthroughCasesInSwitch": false,
21
+ "strictNullChecks": false,
22
+ },
23
+ "exclude": ["node_modules", "dist"]
24
24
  }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const group_privilege_1 = require("../../../../src/components/group-privilege/group-privilege");
13
- const group_privilege_repository_1 = require("../../../../src/components/group-privilege/group-privilege.repository");
14
- const general_1 = require("@tomei/general");
15
- describe('GroupPrivilege', () => {
16
- afterEach(() => {
17
- jest.restoreAllMocks();
18
- });
19
- it('should initialize with GroupPrivilegeAttr', () => __awaiter(void 0, void 0, void 0, function* () {
20
- const mockGroupPrivilegeAttr = {
21
- GroupPrivilegeId: 1,
22
- GroupCode: 'group1',
23
- PrivilegeCode: 'privilege1',
24
- Status: 'active',
25
- CreatedAt: new Date(),
26
- UpdatedAt: new Date(),
27
- CreatedById: 1,
28
- UpdatedById: 1,
29
- };
30
- const findOneMock = jest
31
- .spyOn(group_privilege_repository_1.GroupPrivilegeRepository.prototype, 'findOne')
32
- .mockResolvedValueOnce({ get: jest.fn().mockReturnValue(mockGroupPrivilegeAttr) });
33
- const groupPrivilege = yield group_privilege_1.GroupPrivilege.init(null, 1);
34
- expect(findOneMock).toBeCalledWith({
35
- where: { GroupPrivilegeId: 1 },
36
- transaction: null,
37
- });
38
- expect(groupPrivilege).toBeInstanceOf(group_privilege_1.GroupPrivilege);
39
- expect(groupPrivilege.GroupPrivilegeId).toEqual(mockGroupPrivilegeAttr.GroupPrivilegeId);
40
- expect(groupPrivilege.GroupCode).toEqual(mockGroupPrivilegeAttr.GroupCode);
41
- expect(groupPrivilege.PrivilegeCode).toEqual(mockGroupPrivilegeAttr.PrivilegeCode);
42
- expect(groupPrivilege.Status).toEqual(mockGroupPrivilegeAttr.Status);
43
- expect(groupPrivilege.CreatedAt).toEqual(mockGroupPrivilegeAttr.CreatedAt);
44
- expect(groupPrivilege.UpdatedAt).toEqual(mockGroupPrivilegeAttr.UpdatedAt);
45
- expect(groupPrivilege.CreatedById).toEqual(mockGroupPrivilegeAttr.CreatedById);
46
- expect(groupPrivilege.UpdatedById).toEqual(mockGroupPrivilegeAttr.UpdatedById);
47
- }));
48
- it('should throw ClassError when GroupPrivilegeAttr is not found', () => __awaiter(void 0, void 0, void 0, function* () {
49
- const findOneMock = jest
50
- .spyOn(group_privilege_repository_1.GroupPrivilegeRepository.prototype, 'findOne')
51
- .mockResolvedValueOnce(null);
52
- yield expect(group_privilege_1.GroupPrivilege.init(null, 1)).rejects.toThrow(general_1.ClassError);
53
- expect(findOneMock).toBeCalledWith({
54
- where: { GroupPrivilegeId: 1 },
55
- transaction: null,
56
- });
57
- }));
58
- it('should initialize with default values', () => __awaiter(void 0, void 0, void 0, function* () {
59
- const groupPrivilege = yield group_privilege_1.GroupPrivilege.init();
60
- expect(groupPrivilege).toBeInstanceOf(group_privilege_1.GroupPrivilege);
61
- expect(groupPrivilege.GroupPrivilegeId).toBeUndefined();
62
- expect(groupPrivilege.GroupCode).toBeUndefined();
63
- expect(groupPrivilege.PrivilegeCode).toBeUndefined();
64
- expect(groupPrivilege.Status).toBeUndefined();
65
- expect(groupPrivilege.CreatedAt).toBeUndefined();
66
- expect(groupPrivilege.UpdatedAt).toBeUndefined();
67
- expect(groupPrivilege.CreatedById).toBeUndefined();
68
- expect(groupPrivilege.UpdatedById).toBeUndefined();
69
- }));
70
- });
71
- //# sourceMappingURL=group-privilege.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group-privilege.test.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/group-privilege/group-privilege.test.ts"],"names":[],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- describe('LoginUser', () => {
2
- it('should be true', () => {
3
- expect(true).toBe(true);
4
- });
5
- });
6
- //# sourceMappingURL=login-user.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login-user.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/login-user/login-user.spec.ts"],"names":[],"mappings":"AAuuBA,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}