@tomei/sso 0.60.4-dev.6 → 0.60.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.
- package/.husky/commit-msg +6 -0
- package/.husky/pre-commit +0 -0
- package/dist/components/api-key/api-key.d.ts +85 -0
- package/dist/components/api-key/api-key.d.ts.map +1 -0
- package/dist/components/api-key/api-key.js +245 -0
- package/dist/components/api-key/api-key.js.map +1 -0
- package/dist/components/api-key/api-key.repository.d.ts +7 -0
- package/dist/components/api-key/api-key.repository.d.ts.map +1 -0
- package/dist/components/api-key/api-key.repository.js +18 -0
- package/dist/components/api-key/api-key.repository.js.map +1 -0
- package/dist/components/api-key/index.d.ts +4 -0
- package/dist/components/api-key/index.d.ts.map +1 -0
- package/dist/components/api-key/index.js +8 -0
- package/dist/components/api-key/index.js.map +1 -0
- package/dist/components/building/building.repository.d.ts +7 -0
- package/dist/components/building/building.repository.d.ts.map +1 -0
- package/dist/components/building/building.repository.js +30 -0
- package/dist/components/building/building.repository.js.map +1 -0
- package/dist/components/building/index.d.ts +2 -0
- package/dist/components/building/index.d.ts.map +1 -0
- package/dist/components/building/index.js +18 -0
- package/dist/components/building/index.js.map +1 -0
- package/dist/components/group/group.d.ts +129 -0
- package/dist/components/group/group.d.ts.map +1 -0
- package/dist/components/group/group.js +1337 -0
- package/dist/components/group/group.js.map +1 -0
- package/dist/components/group/group.repository.d.ts +8 -0
- package/dist/components/group/group.repository.d.ts.map +1 -0
- package/dist/components/group/group.repository.js +29 -0
- package/dist/components/group/group.repository.js.map +1 -0
- package/dist/components/group/index.d.ts +3 -0
- package/dist/components/group/index.d.ts.map +1 -0
- package/dist/components/group/index.js +19 -0
- package/dist/components/group/index.js.map +1 -0
- package/dist/components/group-object-privilege/group-object-privilege.d.ts +28 -0
- package/dist/components/group-object-privilege/group-object-privilege.d.ts.map +1 -0
- package/dist/components/group-object-privilege/group-object-privilege.js +163 -0
- package/dist/components/group-object-privilege/group-object-privilege.js.map +1 -0
- package/dist/components/group-object-privilege/group-object-privilege.repository.d.ts +7 -0
- package/dist/components/group-object-privilege/group-object-privilege.repository.d.ts.map +1 -0
- package/dist/components/group-object-privilege/group-object-privilege.repository.js +26 -0
- package/dist/components/group-object-privilege/group-object-privilege.repository.js.map +1 -0
- package/dist/components/group-object-privilege/index.d.ts +3 -0
- package/dist/components/group-object-privilege/index.d.ts.map +1 -0
- package/dist/components/group-object-privilege/index.js +19 -0
- package/dist/components/group-object-privilege/index.js.map +1 -0
- package/dist/components/group-privilege/group-privilege.d.ts +25 -0
- package/dist/components/group-privilege/group-privilege.d.ts.map +1 -0
- package/dist/components/group-privilege/group-privilege.js +67 -0
- package/dist/components/group-privilege/group-privilege.js.map +1 -0
- package/dist/components/group-privilege/group-privilege.repository.d.ts +7 -0
- package/dist/components/group-privilege/group-privilege.repository.d.ts.map +1 -0
- package/dist/components/group-privilege/group-privilege.repository.js +28 -0
- package/dist/components/group-privilege/group-privilege.repository.js.map +1 -0
- package/dist/components/group-privilege/index.d.ts +3 -0
- package/dist/components/group-privilege/index.d.ts.map +1 -0
- package/dist/components/group-privilege/index.js +19 -0
- package/dist/components/group-privilege/index.js.map +1 -0
- package/dist/components/group-reporting-user/group-reporting-user.d.ts +30 -0
- package/dist/components/group-reporting-user/group-reporting-user.d.ts.map +1 -0
- package/dist/components/group-reporting-user/group-reporting-user.js +277 -0
- package/dist/components/group-reporting-user/group-reporting-user.js.map +1 -0
- package/dist/components/group-reporting-user/group-reporting-user.repository.d.ts +7 -0
- package/dist/components/group-reporting-user/group-reporting-user.repository.d.ts.map +1 -0
- package/dist/components/group-reporting-user/group-reporting-user.repository.js +23 -0
- package/dist/components/group-reporting-user/group-reporting-user.repository.js.map +1 -0
- package/dist/components/group-reporting-user/index.d.ts +3 -0
- package/dist/components/group-reporting-user/index.d.ts.map +1 -0
- package/dist/components/group-reporting-user/index.js +19 -0
- package/dist/components/group-reporting-user/index.js.map +1 -0
- package/dist/components/group-system-access/group-system-access.d.ts +28 -0
- package/dist/components/group-system-access/group-system-access.d.ts.map +1 -0
- package/dist/components/group-system-access/group-system-access.js +70 -0
- package/dist/components/group-system-access/group-system-access.js.map +1 -0
- package/dist/components/group-system-access/group-system-access.repository.d.ts +8 -0
- package/dist/components/group-system-access/group-system-access.repository.d.ts.map +1 -0
- package/dist/components/group-system-access/group-system-access.repository.js +46 -0
- package/dist/components/group-system-access/group-system-access.repository.js.map +1 -0
- package/dist/components/group-system-access/index.d.ts +3 -0
- package/dist/components/group-system-access/index.d.ts.map +1 -0
- package/dist/components/group-system-access/index.js +19 -0
- package/dist/components/group-system-access/index.js.map +1 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +34 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/login-history/index.d.ts +2 -0
- package/dist/components/login-history/index.d.ts.map +1 -0
- package/dist/components/login-history/index.js +18 -0
- package/dist/components/login-history/index.js.map +1 -0
- package/dist/components/login-history/login-history.repository.d.ts +6 -0
- package/dist/components/login-history/login-history.repository.d.ts.map +1 -0
- package/dist/components/login-history/login-history.repository.js +15 -0
- package/dist/components/login-history/login-history.repository.js.map +1 -0
- package/dist/components/login-user/index.d.ts +5 -0
- package/dist/components/login-user/index.d.ts.map +1 -0
- package/dist/components/login-user/index.js +21 -0
- package/dist/components/login-user/index.js.map +1 -0
- package/dist/components/login-user/interfaces/check-user-info-duplicated.interface.d.ts +8 -0
- package/dist/components/login-user/interfaces/check-user-info-duplicated.interface.d.ts.map +1 -0
- package/dist/components/login-user/interfaces/check-user-info-duplicated.interface.js +3 -0
- package/dist/components/login-user/interfaces/check-user-info-duplicated.interface.js.map +1 -0
- package/dist/components/login-user/interfaces/index.d.ts +2 -0
- package/dist/components/login-user/interfaces/index.d.ts.map +1 -0
- package/dist/components/login-user/interfaces/index.js +18 -0
- package/dist/components/login-user/interfaces/index.js.map +1 -0
- package/dist/components/login-user/interfaces/system-access.interface.d.ts +14 -0
- package/dist/components/login-user/interfaces/system-access.interface.d.ts.map +1 -0
- package/dist/{src/interfaces/login-history.interface.js → components/login-user/interfaces/system-access.interface.js} +1 -1
- package/dist/components/login-user/interfaces/system-access.interface.js.map +1 -0
- package/dist/components/login-user/interfaces/user-info.interface.d.ts +31 -0
- package/dist/components/login-user/interfaces/user-info.interface.d.ts.map +1 -0
- package/dist/{src/interfaces/login-history-search-attr.interface.js → components/login-user/interfaces/user-info.interface.js} +1 -1
- package/dist/components/login-user/interfaces/user-info.interface.js.map +1 -0
- package/dist/components/login-user/login-user.d.ts +14 -0
- package/dist/components/login-user/login-user.d.ts.map +1 -0
- package/dist/components/login-user/login-user.js +127 -0
- package/dist/components/login-user/login-user.js.map +1 -0
- package/dist/components/login-user/user.d.ts +155 -0
- package/dist/components/login-user/user.d.ts.map +1 -0
- package/dist/components/login-user/user.js +1753 -0
- package/dist/components/login-user/user.js.map +1 -0
- package/dist/components/login-user/user.repository.d.ts +6 -0
- package/dist/components/login-user/user.repository.d.ts.map +1 -0
- package/dist/components/login-user/user.repository.js +15 -0
- package/dist/components/login-user/user.repository.js.map +1 -0
- package/dist/components/password-hash/index.d.ts +3 -0
- package/dist/components/password-hash/index.d.ts.map +1 -0
- package/dist/components/password-hash/index.js +19 -0
- package/dist/components/password-hash/index.js.map +1 -0
- package/dist/components/password-hash/interfaces/index.d.ts +2 -0
- package/dist/components/password-hash/interfaces/index.d.ts.map +1 -0
- package/dist/components/password-hash/interfaces/index.js +18 -0
- package/dist/components/password-hash/interfaces/index.js.map +1 -0
- package/dist/components/password-hash/interfaces/password-hash-service.interface.d.ts +5 -0
- package/dist/components/password-hash/interfaces/password-hash-service.interface.d.ts.map +1 -0
- package/dist/components/password-hash/interfaces/password-hash-service.interface.js +3 -0
- package/dist/components/password-hash/interfaces/password-hash-service.interface.js.map +1 -0
- package/dist/components/password-hash/password-hash.service.d.ts +7 -0
- package/dist/components/password-hash/password-hash.service.d.ts.map +1 -0
- package/dist/components/password-hash/password-hash.service.js +48 -0
- package/dist/components/password-hash/password-hash.service.js.map +1 -0
- package/dist/components/staff/index.d.ts +2 -0
- package/dist/components/staff/index.d.ts.map +1 -0
- package/dist/components/staff/index.js +18 -0
- package/dist/components/staff/index.js.map +1 -0
- package/dist/components/staff/staff.repository.d.ts +7 -0
- package/dist/components/staff/staff.repository.d.ts.map +1 -0
- package/dist/components/staff/staff.repository.js +30 -0
- package/dist/components/staff/staff.repository.js.map +1 -0
- package/dist/components/system/index.d.ts +3 -0
- package/dist/components/system/index.d.ts.map +1 -0
- package/dist/components/system/index.js +19 -0
- package/dist/components/system/index.js.map +1 -0
- package/dist/components/system/system.d.ts +40 -0
- package/dist/components/system/system.d.ts.map +1 -0
- package/dist/components/system/system.js +283 -0
- package/dist/components/system/system.js.map +1 -0
- package/dist/components/system/system.repository.d.ts +6 -0
- package/dist/components/system/system.repository.d.ts.map +1 -0
- package/dist/components/system/system.repository.js +15 -0
- package/dist/components/system/system.repository.js.map +1 -0
- package/dist/components/system-privilege/index.d.ts +4 -0
- package/dist/components/system-privilege/index.d.ts.map +1 -0
- package/dist/components/system-privilege/index.js +8 -0
- package/dist/components/system-privilege/index.js.map +1 -0
- package/dist/components/system-privilege/system-privilege.d.ts +53 -0
- package/dist/components/system-privilege/system-privilege.d.ts.map +1 -0
- package/dist/components/system-privilege/system-privilege.js +315 -0
- package/dist/components/system-privilege/system-privilege.js.map +1 -0
- package/dist/components/system-privilege/system-privilege.repository.d.ts +7 -0
- package/dist/components/system-privilege/system-privilege.repository.d.ts.map +1 -0
- package/dist/components/system-privilege/system-privilege.repository.js +21 -0
- package/dist/components/system-privilege/system-privilege.repository.js.map +1 -0
- package/dist/components/user-group/index.d.ts +3 -0
- package/dist/components/user-group/index.d.ts.map +1 -0
- package/dist/components/user-group/index.js +19 -0
- package/dist/components/user-group/index.js.map +1 -0
- package/dist/components/user-group/user-group.d.ts +51 -0
- package/dist/components/user-group/user-group.d.ts.map +1 -0
- package/dist/components/user-group/user-group.js +335 -0
- package/dist/components/user-group/user-group.js.map +1 -0
- package/dist/components/user-group/user-group.repository.d.ts +6 -0
- package/dist/components/user-group/user-group.repository.d.ts.map +1 -0
- package/dist/components/user-group/user-group.repository.js +15 -0
- package/dist/components/user-group/user-group.repository.js.map +1 -0
- package/dist/components/user-object-privilege/index.d.ts +3 -0
- package/dist/components/user-object-privilege/index.d.ts.map +1 -0
- package/dist/components/user-object-privilege/index.js +19 -0
- package/dist/components/user-object-privilege/index.js.map +1 -0
- package/dist/components/user-object-privilege/user-object-privilege.d.ts +24 -0
- package/dist/components/user-object-privilege/user-object-privilege.d.ts.map +1 -0
- package/dist/components/user-object-privilege/user-object-privilege.js +59 -0
- package/dist/components/user-object-privilege/user-object-privilege.js.map +1 -0
- package/dist/components/user-object-privilege/user-object-privilege.repository.d.ts +6 -0
- package/dist/components/user-object-privilege/user-object-privilege.repository.d.ts.map +1 -0
- package/dist/components/user-object-privilege/user-object-privilege.repository.js +15 -0
- package/dist/components/user-object-privilege/user-object-privilege.repository.js.map +1 -0
- package/dist/components/user-privilege/index.d.ts +3 -0
- package/dist/components/user-privilege/index.d.ts.map +1 -0
- package/dist/components/user-privilege/index.js +19 -0
- package/dist/components/user-privilege/index.js.map +1 -0
- package/dist/components/user-privilege/user-privilege.d.ts +71 -0
- package/dist/components/user-privilege/user-privilege.d.ts.map +1 -0
- package/dist/components/user-privilege/user-privilege.js +388 -0
- package/dist/components/user-privilege/user-privilege.js.map +1 -0
- package/dist/components/user-privilege/user-privilege.repository.d.ts +7 -0
- package/dist/components/user-privilege/user-privilege.repository.d.ts.map +1 -0
- package/dist/components/user-privilege/user-privilege.repository.js +29 -0
- package/dist/components/user-privilege/user-privilege.repository.js.map +1 -0
- package/dist/components/user-system-access/index.d.ts +3 -0
- package/dist/components/user-system-access/index.d.ts.map +1 -0
- package/dist/components/user-system-access/index.js +19 -0
- package/dist/components/user-system-access/index.js.map +1 -0
- package/dist/components/user-system-access/user-system-access.d.ts +69 -0
- package/dist/components/user-system-access/user-system-access.d.ts.map +1 -0
- package/dist/components/user-system-access/user-system-access.js +413 -0
- package/dist/components/user-system-access/user-system-access.js.map +1 -0
- package/dist/components/user-system-access/user-system-access.repository.d.ts +8 -0
- package/dist/components/user-system-access/user-system-access.repository.d.ts.map +1 -0
- package/dist/components/user-system-access/user-system-access.repository.js +44 -0
- package/dist/components/user-system-access/user-system-access.repository.js.map +1 -0
- package/dist/database.d.ts +5 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +14 -0
- package/dist/database.js.map +1 -0
- package/dist/enum/api-key.enum.d.ts +6 -0
- package/dist/enum/api-key.enum.d.ts.map +1 -0
- package/dist/enum/api-key.enum.js +10 -0
- package/dist/enum/api-key.enum.js.map +1 -0
- package/dist/enum/group-type.enum.d.ts +9 -0
- package/dist/enum/group-type.enum.d.ts.map +1 -0
- package/dist/enum/group-type.enum.js +13 -0
- package/dist/enum/group-type.enum.js.map +1 -0
- package/dist/enum/index.d.ts +7 -0
- package/dist/enum/index.d.ts.map +1 -0
- package/dist/enum/index.js +23 -0
- package/dist/enum/index.js.map +1 -0
- package/dist/enum/login-status.enum.d.ts +5 -0
- package/dist/enum/login-status.enum.d.ts.map +1 -0
- package/dist/enum/login-status.enum.js +9 -0
- package/dist/enum/login-status.enum.js.map +1 -0
- package/dist/enum/object-status.enum.d.ts +5 -0
- package/dist/enum/object-status.enum.d.ts.map +1 -0
- package/dist/enum/object-status.enum.js +9 -0
- package/dist/enum/object-status.enum.js.map +1 -0
- package/dist/enum/user-status.enum.d.ts +8 -0
- package/dist/enum/user-status.enum.d.ts.map +1 -0
- package/dist/enum/user-status.enum.js +12 -0
- package/dist/enum/user-status.enum.js.map +1 -0
- package/dist/enum/yn.enum.d.ts +5 -0
- package/dist/enum/yn.enum.d.ts.map +1 -0
- package/dist/enum/yn.enum.js +9 -0
- package/dist/enum/yn.enum.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/interfaces/api-key-attr.interface.d.ts +16 -0
- package/dist/interfaces/api-key-attr.interface.d.ts.map +1 -0
- package/dist/interfaces/api-key-attr.interface.js +3 -0
- package/dist/interfaces/api-key-attr.interface.js.map +1 -0
- package/dist/interfaces/group-object-privilege.interface.d.ts +14 -0
- package/dist/interfaces/group-object-privilege.interface.d.ts.map +1 -0
- package/dist/interfaces/group-object-privilege.interface.js +3 -0
- package/dist/interfaces/group-object-privilege.interface.js.map +1 -0
- package/dist/interfaces/group-privilege.interface.d.ts +11 -0
- package/dist/interfaces/group-privilege.interface.d.ts.map +1 -0
- package/dist/interfaces/group-privilege.interface.js +3 -0
- package/dist/interfaces/group-privilege.interface.js.map +1 -0
- package/dist/interfaces/group-reporting-user.interface.d.ts +12 -0
- package/dist/interfaces/group-reporting-user.interface.d.ts.map +1 -0
- package/dist/interfaces/group-reporting-user.interface.js +3 -0
- package/dist/interfaces/group-reporting-user.interface.js.map +1 -0
- package/dist/interfaces/group-search-attr.interface.d.ts +9 -0
- package/dist/interfaces/group-search-attr.interface.d.ts.map +1 -0
- package/dist/interfaces/group-search-attr.interface.js +3 -0
- package/dist/interfaces/group-search-attr.interface.js.map +1 -0
- package/dist/interfaces/group-system-access.interface.d.ts +11 -0
- package/dist/interfaces/group-system-access.interface.d.ts.map +1 -0
- package/dist/interfaces/group-system-access.interface.js +3 -0
- package/dist/interfaces/group-system-access.interface.js.map +1 -0
- package/dist/interfaces/group.interface.d.ts +17 -0
- package/dist/interfaces/group.interface.d.ts.map +1 -0
- package/dist/interfaces/group.interface.js +3 -0
- package/dist/interfaces/group.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +14 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +30 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/system-login.interface.d.ts +7 -0
- package/dist/interfaces/system-login.interface.d.ts.map +1 -0
- package/dist/interfaces/system-login.interface.js +3 -0
- package/dist/interfaces/system-login.interface.js.map +1 -0
- package/dist/interfaces/system-privilege-search.interface.d.ts +6 -0
- package/dist/interfaces/system-privilege-search.interface.d.ts.map +1 -0
- package/dist/interfaces/system-privilege-search.interface.js +3 -0
- package/dist/interfaces/system-privilege-search.interface.js.map +1 -0
- package/dist/interfaces/system-privilege.interface.d.ts +12 -0
- package/dist/interfaces/system-privilege.interface.d.ts.map +1 -0
- package/dist/interfaces/system-privilege.interface.js +3 -0
- package/dist/interfaces/system-privilege.interface.js.map +1 -0
- package/dist/interfaces/system-search-attr.interface.d.ts +6 -0
- package/dist/interfaces/system-search-attr.interface.d.ts.map +1 -0
- package/dist/interfaces/system-search-attr.interface.js +3 -0
- package/dist/interfaces/system-search-attr.interface.js.map +1 -0
- package/dist/interfaces/system.interface.d.ts +16 -0
- package/dist/interfaces/system.interface.d.ts.map +1 -0
- package/dist/interfaces/system.interface.js +3 -0
- package/dist/interfaces/system.interface.js.map +1 -0
- package/dist/interfaces/user-group.interface.d.ts +13 -0
- package/dist/interfaces/user-group.interface.d.ts.map +1 -0
- package/dist/interfaces/user-group.interface.js +3 -0
- package/dist/interfaces/user-group.interface.js.map +1 -0
- package/dist/interfaces/user-object-privilege.interface.d.ts +14 -0
- package/dist/interfaces/user-object-privilege.interface.d.ts.map +1 -0
- package/dist/interfaces/user-object-privilege.interface.js +3 -0
- package/dist/interfaces/user-object-privilege.interface.js.map +1 -0
- package/dist/interfaces/user-privilege.interface.d.ts +11 -0
- package/dist/interfaces/user-privilege.interface.d.ts.map +1 -0
- package/dist/interfaces/user-privilege.interface.js +3 -0
- package/dist/interfaces/user-privilege.interface.js.map +1 -0
- package/dist/interfaces/user-session.interface.d.ts +5 -0
- package/dist/interfaces/user-session.interface.d.ts.map +1 -0
- package/dist/interfaces/user-session.interface.js +3 -0
- package/dist/interfaces/user-session.interface.js.map +1 -0
- package/dist/interfaces/user-system-access.interface.d.ts +11 -0
- package/dist/interfaces/user-system-access.interface.d.ts.map +1 -0
- package/dist/interfaces/user-system-access.interface.js +3 -0
- package/dist/interfaces/user-system-access.interface.js.map +1 -0
- package/dist/models/api-key-entity.d.ts +22 -0
- package/dist/models/api-key-entity.d.ts.map +1 -0
- package/dist/models/api-key-entity.js +125 -0
- package/dist/models/api-key-entity.js.map +1 -0
- package/dist/models/building.entity.d.ts +30 -0
- package/dist/models/building.entity.d.ts.map +1 -0
- package/dist/models/building.entity.js +216 -0
- package/dist/models/building.entity.js.map +1 -0
- package/dist/models/group-object-privilege.entity.d.ts +22 -0
- package/dist/models/group-object-privilege.entity.d.ts.map +1 -0
- package/dist/models/group-object-privilege.entity.js +114 -0
- package/dist/models/group-object-privilege.entity.js.map +1 -0
- package/dist/models/group-privilege.entity.d.ts +19 -0
- package/dist/models/group-privilege.entity.d.ts.map +1 -0
- package/dist/models/group-privilege.entity.js +99 -0
- package/dist/models/group-privilege.entity.js.map +1 -0
- package/dist/models/group-reporting-user.entity.d.ts +18 -0
- package/dist/models/group-reporting-user.entity.d.ts.map +1 -0
- package/dist/models/group-reporting-user.entity.js +117 -0
- package/dist/models/group-reporting-user.entity.js.map +1 -0
- package/dist/models/group-system-access.entity.d.ts +19 -0
- package/dist/models/group-system-access.entity.d.ts.map +1 -0
- package/dist/models/group-system-access.entity.js +102 -0
- package/dist/models/group-system-access.entity.js.map +1 -0
- package/dist/models/group.entity.d.ts +33 -0
- package/dist/models/group.entity.d.ts.map +1 -0
- package/dist/models/group.entity.js +157 -0
- package/dist/models/group.entity.js.map +1 -0
- package/dist/models/login-history.entity.d.ts +15 -0
- package/dist/models/login-history.entity.d.ts.map +1 -0
- package/dist/models/login-history.entity.js +81 -0
- package/dist/models/login-history.entity.js.map +1 -0
- package/dist/models/staff.entity.d.ts +19 -0
- package/dist/models/staff.entity.d.ts.map +1 -0
- package/dist/models/staff.entity.js +113 -0
- package/dist/models/staff.entity.js.map +1 -0
- package/dist/models/system-privilege.entity.d.ts +19 -0
- package/dist/models/system-privilege.entity.d.ts.map +1 -0
- package/dist/models/system-privilege.entity.js +111 -0
- package/dist/models/system-privilege.entity.js.map +1 -0
- package/dist/models/system.entity.d.ts +26 -0
- package/dist/models/system.entity.d.ts.map +1 -0
- package/dist/models/system.entity.js +139 -0
- package/dist/models/system.entity.js.map +1 -0
- package/dist/models/user-group.entity.d.ts +20 -0
- package/dist/models/user-group.entity.d.ts.map +1 -0
- package/dist/models/user-group.entity.js +114 -0
- package/dist/models/user-group.entity.js.map +1 -0
- package/dist/models/user-object-privilege.entity.d.ts +21 -0
- package/dist/models/user-object-privilege.entity.d.ts.map +1 -0
- package/dist/models/user-object-privilege.entity.js +113 -0
- package/dist/models/user-object-privilege.entity.js.map +1 -0
- package/dist/models/user-privilege.entity.d.ts +18 -0
- package/dist/models/user-privilege.entity.d.ts.map +1 -0
- package/dist/models/user-privilege.entity.js +99 -0
- package/dist/models/user-privilege.entity.js.map +1 -0
- package/dist/models/user-system-access.entity.d.ts +18 -0
- package/dist/models/user-system-access.entity.d.ts.map +1 -0
- package/dist/models/user-system-access.entity.js +108 -0
- package/dist/models/user-system-access.entity.js.map +1 -0
- package/dist/models/user.entity.d.ts +41 -0
- package/dist/models/user.entity.d.ts.map +1 -0
- package/dist/models/user.entity.js +218 -0
- package/dist/models/user.entity.js.map +1 -0
- package/dist/redis-client/__mocks__/jest-initial-setup.d.ts +2 -0
- package/dist/redis-client/__mocks__/jest-initial-setup.d.ts.map +1 -0
- package/dist/redis-client/__mocks__/jest-initial-setup.js +8 -0
- package/dist/redis-client/__mocks__/jest-initial-setup.js.map +1 -0
- package/dist/redis-client/__mocks__/redis-mock.d.ts +3 -0
- package/dist/redis-client/__mocks__/redis-mock.d.ts.map +1 -0
- package/dist/redis-client/__mocks__/redis-mock.js +56 -0
- package/dist/redis-client/__mocks__/redis-mock.js.map +1 -0
- package/dist/redis-client/index.d.ts +2 -0
- package/dist/redis-client/index.d.ts.map +1 -0
- package/dist/redis-client/index.js +18 -0
- package/dist/redis-client/index.js.map +1 -0
- package/dist/redis-client/redis.service.d.ts +10 -0
- package/dist/redis-client/redis.service.d.ts.map +1 -0
- package/dist/redis-client/redis.service.js +69 -0
- package/dist/redis-client/redis.service.js.map +1 -0
- package/dist/session/index.d.ts +3 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +19 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/interfaces/index.d.ts +2 -0
- package/dist/session/interfaces/index.d.ts.map +1 -0
- package/dist/session/interfaces/index.js +18 -0
- package/dist/session/interfaces/index.js.map +1 -0
- package/dist/session/interfaces/session-service.interface.d.ts +10 -0
- package/dist/session/interfaces/session-service.interface.d.ts.map +1 -0
- package/dist/session/interfaces/session-service.interface.js +3 -0
- package/dist/session/interfaces/session-service.interface.js.map +1 -0
- package/dist/session/session.service.d.ts +14 -0
- package/dist/session/session.service.d.ts.map +1 -0
- package/dist/session/session.service.js +73 -0
- package/dist/session/session.service.js.map +1 -0
- package/dist/src/components/login-history/index.d.ts +0 -1
- package/dist/src/components/login-history/index.js +0 -1
- package/dist/src/components/login-history/index.js.map +1 -1
- package/dist/src/components/login-history/login-history.repository.d.ts +2 -2
- package/dist/src/components/login-history/login-history.repository.js.map +1 -1
- package/dist/src/components/login-user/user.js +1 -1
- package/dist/src/components/login-user/user.js.map +1 -1
- package/dist/src/components/user-system-access/user-system-access.js +1 -1
- package/dist/src/components/user-system-access/user-system-access.js.map +1 -1
- package/dist/src/models/login-history.entity.d.ts +2 -2
- package/dist/src/models/login-history.entity.js +13 -13
- package/dist/src/models/login-history.entity.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/auth-context.d.ts +7 -0
- package/dist/types/auth-context.d.ts.map +1 -0
- package/dist/types/auth-context.js +3 -0
- package/dist/types/auth-context.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +2 -2
- package/src/components/login-history/index.ts +0 -1
- package/src/components/login-history/login-history.repository.ts +4 -4
- package/src/components/login-user/user.ts +1 -1
- package/src/components/user-system-access/user-system-access.ts +1 -1
- package/src/models/login-history.entity.ts +2 -2
- package/dist/src/components/login-history/login-history.d.ts +0 -23
- package/dist/src/components/login-history/login-history.js +0 -84
- package/dist/src/components/login-history/login-history.js.map +0 -1
- package/dist/src/interfaces/login-history-search-attr.interface.d.ts +0 -8
- package/dist/src/interfaces/login-history-search-attr.interface.js.map +0 -1
- package/dist/src/interfaces/login-history.interface.d.ts +0 -11
- package/dist/src/interfaces/login-history.interface.js.map +0 -1
- package/src/components/login-history/login-history.ts +0 -119
- package/src/interfaces/login-history-search-attr.interface.ts +0 -8
- package/src/interfaces/login-history.interface.ts +0 -11
@@ -0,0 +1,1753 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
37
|
+
};
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
+
exports.User = void 0;
|
40
|
+
const general_1 = require("@tomei/general");
|
41
|
+
const user_repository_1 = require("./user.repository");
|
42
|
+
const system_repository_1 = require("../system/system.repository");
|
43
|
+
const login_history_repository_1 = require("../login-history/login-history.repository");
|
44
|
+
const password_hash_service_1 = require("../password-hash/password-hash.service");
|
45
|
+
const user_group_repository_1 = require("../user-group/user-group.repository");
|
46
|
+
const staff_entity_1 = __importDefault(require("../../models/staff.entity"));
|
47
|
+
const system_privilege_entity_1 = __importDefault(require("../../models/system-privilege.entity"));
|
48
|
+
const yn_enum_1 = require("../../enum/yn.enum");
|
49
|
+
const enum_1 = require("../../enum");
|
50
|
+
const config_1 = require("@tomei/config");
|
51
|
+
const sequelize_1 = require("sequelize");
|
52
|
+
const activity_history_1 = require("@tomei/activity-history");
|
53
|
+
const user_entity_1 = __importDefault(require("../../models/user.entity"));
|
54
|
+
const group_entity_1 = __importDefault(require("../../models/group.entity"));
|
55
|
+
const group_system_access_repository_1 = require("../group-system-access/group-system-access.repository");
|
56
|
+
const group_repository_1 = require("../group/group.repository");
|
57
|
+
const system_entity_1 = __importDefault(require("../../models/system.entity"));
|
58
|
+
const user_system_access_repository_1 = require("../user-system-access/user-system-access.repository");
|
59
|
+
const group_system_access_entity_1 = __importDefault(require("../../models/group-system-access.entity"));
|
60
|
+
const user_privilege_repository_1 = require("../user-privilege/user-privilege.repository");
|
61
|
+
const user_object_privilege_repository_1 = require("../user-object-privilege/user-object-privilege.repository");
|
62
|
+
const group_privilege_entity_1 = __importDefault(require("../../models/group-privilege.entity"));
|
63
|
+
const group_object_privilege_repository_1 = require("../group-object-privilege/group-object-privilege.repository");
|
64
|
+
const speakeasy = __importStar(require("speakeasy"));
|
65
|
+
const login_status_enum_1 = require("../../enum/login-status.enum");
|
66
|
+
const redis_service_1 = require("../../redis-client/redis.service");
|
67
|
+
const login_user_1 = require("./login-user");
|
68
|
+
const session_service_1 = require("../../session/session.service");
|
69
|
+
const crypto_1 = require("crypto");
|
70
|
+
class User extends general_1.UserBase {
|
71
|
+
get SessionService() {
|
72
|
+
return this._SessionService;
|
73
|
+
}
|
74
|
+
get UserId() {
|
75
|
+
return parseInt(this.ObjectId);
|
76
|
+
}
|
77
|
+
set UserId(value) {
|
78
|
+
this.ObjectId = value.toString();
|
79
|
+
}
|
80
|
+
get Password() {
|
81
|
+
return this._Password;
|
82
|
+
}
|
83
|
+
set Password(value) {
|
84
|
+
this._Password = value;
|
85
|
+
}
|
86
|
+
get Status() {
|
87
|
+
return this._Status;
|
88
|
+
}
|
89
|
+
set Status(value) {
|
90
|
+
this._Status = value;
|
91
|
+
}
|
92
|
+
get UserName() {
|
93
|
+
return this._UserName;
|
94
|
+
}
|
95
|
+
set UserName(value) {
|
96
|
+
this._UserName = value;
|
97
|
+
}
|
98
|
+
get DefaultPasswordChangedYN() {
|
99
|
+
return this._DefaultPasswordChangedYN;
|
100
|
+
}
|
101
|
+
set DefaultPasswordChangedYN(value) {
|
102
|
+
this._DefaultPasswordChangedYN = value;
|
103
|
+
}
|
104
|
+
get FirstLoginAt() {
|
105
|
+
return this._FirstLoginAt;
|
106
|
+
}
|
107
|
+
set FirstLoginAt(value) {
|
108
|
+
this._FirstLoginAt = value;
|
109
|
+
}
|
110
|
+
get LastLoginAt() {
|
111
|
+
return this._LastLoginAt;
|
112
|
+
}
|
113
|
+
set LastLoginAt(value) {
|
114
|
+
this._LastLoginAt = value;
|
115
|
+
}
|
116
|
+
get MFAEnabled() {
|
117
|
+
return this._MFAEnabled;
|
118
|
+
}
|
119
|
+
set MFAEnabled(value) {
|
120
|
+
this._MFAEnabled = value;
|
121
|
+
}
|
122
|
+
get MFAConfig() {
|
123
|
+
return this._MFAConfig;
|
124
|
+
}
|
125
|
+
set MFAConfig(value) {
|
126
|
+
this._MFAConfig = value;
|
127
|
+
}
|
128
|
+
get RecoveryEmail() {
|
129
|
+
return this._RecoveryEmail;
|
130
|
+
}
|
131
|
+
set RecoveryEmail(value) {
|
132
|
+
this._RecoveryEmail = value;
|
133
|
+
}
|
134
|
+
get FailedLoginAttemptCount() {
|
135
|
+
return this._FailedLoginAttemptCount;
|
136
|
+
}
|
137
|
+
set FailedLoginAttemptCount(value) {
|
138
|
+
this._FailedLoginAttemptCount = value;
|
139
|
+
}
|
140
|
+
get LastFailedLoginAt() {
|
141
|
+
return this._LastFailedLoginAt;
|
142
|
+
}
|
143
|
+
set LastFailedLoginAt(value) {
|
144
|
+
this._LastFailedLoginAt = value;
|
145
|
+
}
|
146
|
+
get LastPasswordChangedAt() {
|
147
|
+
return this._LastPasswordChangedAt;
|
148
|
+
}
|
149
|
+
set LastPasswordChangedAt(value) {
|
150
|
+
this._LastPasswordChangedAt = value;
|
151
|
+
}
|
152
|
+
get NeedToChangePasswordYN() {
|
153
|
+
return this._NeedToChangePasswordYN;
|
154
|
+
}
|
155
|
+
set NeedToChangePasswordYN(value) {
|
156
|
+
this._NeedToChangePasswordYN = value;
|
157
|
+
}
|
158
|
+
get CreatedById() {
|
159
|
+
return this._CreatedById;
|
160
|
+
}
|
161
|
+
set CreatedById(value) {
|
162
|
+
this._CreatedById = value;
|
163
|
+
}
|
164
|
+
get CreatedAt() {
|
165
|
+
return this._CreatedAt;
|
166
|
+
}
|
167
|
+
set CreatedAt(value) {
|
168
|
+
this._CreatedAt = value;
|
169
|
+
}
|
170
|
+
get UpdatedById() {
|
171
|
+
return this._UpdatedById;
|
172
|
+
}
|
173
|
+
set UpdatedById(value) {
|
174
|
+
this._UpdatedById = value;
|
175
|
+
}
|
176
|
+
get UpdatedAt() {
|
177
|
+
return this._UpdatedAt;
|
178
|
+
}
|
179
|
+
set UpdatedAt(value) {
|
180
|
+
this._UpdatedAt = value;
|
181
|
+
}
|
182
|
+
async getDetails() {
|
183
|
+
return {
|
184
|
+
FullName: this.FullName,
|
185
|
+
UserName: this.UserName,
|
186
|
+
IDNo: this.IDNo,
|
187
|
+
IDType: this.IDType,
|
188
|
+
Email: this.Email,
|
189
|
+
ContactNo: this.ContactNo,
|
190
|
+
};
|
191
|
+
}
|
192
|
+
constructor(sessionService, dbTransaction, userInfo) {
|
193
|
+
super();
|
194
|
+
this.ObjectName = 'User';
|
195
|
+
this.TableName = 'sso_Users';
|
196
|
+
this.ObjectType = 'User';
|
197
|
+
this._SessionService = sessionService;
|
198
|
+
if (dbTransaction) {
|
199
|
+
this._dbTransaction = dbTransaction;
|
200
|
+
}
|
201
|
+
if (userInfo) {
|
202
|
+
this.UserId = userInfo.UserId;
|
203
|
+
this.UserName = userInfo.UserName;
|
204
|
+
this.FullName = userInfo.FullName;
|
205
|
+
this.IDNo = userInfo.IDNo;
|
206
|
+
this.IDType = userInfo.IDType;
|
207
|
+
this.Email = userInfo.Email;
|
208
|
+
this.ContactNo = userInfo.ContactNo;
|
209
|
+
this.Password = userInfo.Password;
|
210
|
+
this.staffs = userInfo.staffs;
|
211
|
+
this.Status = userInfo.Status;
|
212
|
+
this.DefaultPasswordChangedYN = userInfo.DefaultPasswordChangedYN;
|
213
|
+
this.FirstLoginAt = userInfo.FirstLoginAt;
|
214
|
+
this.LastLoginAt = userInfo.LastLoginAt;
|
215
|
+
this.MFAEnabled = userInfo.MFAEnabled;
|
216
|
+
this.MFAConfig = userInfo.MFAConfig;
|
217
|
+
this.RecoveryEmail = userInfo.RecoveryEmail;
|
218
|
+
this.FailedLoginAttemptCount = userInfo.FailedLoginAttemptCount;
|
219
|
+
this.LastFailedLoginAt = userInfo.LastFailedLoginAt;
|
220
|
+
this.LastPasswordChangedAt = userInfo.LastPasswordChangedAt;
|
221
|
+
this.NeedToChangePasswordYN = userInfo.NeedToChangePasswordYN;
|
222
|
+
this.CreatedById = userInfo.CreatedById;
|
223
|
+
this.CreatedAt = userInfo.CreatedAt;
|
224
|
+
this.UpdatedById = userInfo.UpdatedById;
|
225
|
+
this.UpdatedAt = userInfo.UpdatedAt;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
static async init(sessionService, userId, dbTransaction = null) {
|
229
|
+
User._RedisService = await redis_service_1.RedisService.init();
|
230
|
+
if (userId) {
|
231
|
+
if (dbTransaction) {
|
232
|
+
User._Repository = new user_repository_1.UserRepository();
|
233
|
+
}
|
234
|
+
const user = await User._Repository.findOne({
|
235
|
+
where: {
|
236
|
+
UserId: userId,
|
237
|
+
},
|
238
|
+
include: [
|
239
|
+
{
|
240
|
+
model: staff_entity_1.default,
|
241
|
+
},
|
242
|
+
],
|
243
|
+
transaction: dbTransaction,
|
244
|
+
});
|
245
|
+
if (!user) {
|
246
|
+
throw new Error('Invalid credentials.');
|
247
|
+
}
|
248
|
+
if (user) {
|
249
|
+
const userAttr = {
|
250
|
+
UserId: user.UserId,
|
251
|
+
UserName: user.UserName,
|
252
|
+
FullName: user?.FullName || null,
|
253
|
+
IDNo: user?.IdNo || null,
|
254
|
+
IDType: user?.IdType || null,
|
255
|
+
ContactNo: user?.ContactNo || null,
|
256
|
+
Email: user.Email,
|
257
|
+
Password: user.Password,
|
258
|
+
Status: user.Status,
|
259
|
+
DefaultPasswordChangedYN: user.DefaultPasswordChangedYN,
|
260
|
+
FirstLoginAt: user.FirstLoginAt,
|
261
|
+
LastLoginAt: user.LastLoginAt,
|
262
|
+
MFAEnabled: user.MFAEnabled,
|
263
|
+
MFAConfig: user.MFAConfig,
|
264
|
+
RecoveryEmail: user.RecoveryEmail,
|
265
|
+
FailedLoginAttemptCount: user.FailedLoginAttemptCount,
|
266
|
+
LastFailedLoginAt: user.LastFailedLoginAt,
|
267
|
+
LastPasswordChangedAt: user.LastPasswordChangedAt,
|
268
|
+
NeedToChangePasswordYN: user.NeedToChangePasswordYN,
|
269
|
+
CreatedById: user.CreatedById,
|
270
|
+
CreatedAt: user.CreatedAt,
|
271
|
+
UpdatedById: user.UpdatedById,
|
272
|
+
UpdatedAt: user.UpdatedAt,
|
273
|
+
staffs: user?.Staff,
|
274
|
+
};
|
275
|
+
return new User(sessionService, dbTransaction, userAttr);
|
276
|
+
}
|
277
|
+
else {
|
278
|
+
throw new Error('User not found');
|
279
|
+
}
|
280
|
+
}
|
281
|
+
return new User(sessionService, dbTransaction);
|
282
|
+
}
|
283
|
+
async setEmail(email, dbTransaction) {
|
284
|
+
try {
|
285
|
+
if (this.Email === email) {
|
286
|
+
return;
|
287
|
+
}
|
288
|
+
const user = await User._Repository.findOne({
|
289
|
+
where: {
|
290
|
+
Email: email,
|
291
|
+
},
|
292
|
+
transaction: dbTransaction,
|
293
|
+
});
|
294
|
+
if (user) {
|
295
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Email already exists');
|
296
|
+
}
|
297
|
+
this.Email = email;
|
298
|
+
}
|
299
|
+
catch (error) {
|
300
|
+
throw error;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
async login(systemCode, email, password, ipAddress, dbTransaction) {
|
304
|
+
try {
|
305
|
+
if (!this.ObjectId) {
|
306
|
+
const user = await User._Repository.findOne({
|
307
|
+
transaction: dbTransaction,
|
308
|
+
where: {
|
309
|
+
Email: email,
|
310
|
+
Status: {
|
311
|
+
[sequelize_1.Op.or]: [enum_1.UserStatus.ACTIVE, enum_1.UserStatus.LOCKED],
|
312
|
+
},
|
313
|
+
},
|
314
|
+
include: [
|
315
|
+
{
|
316
|
+
model: staff_entity_1.default,
|
317
|
+
},
|
318
|
+
],
|
319
|
+
});
|
320
|
+
if (user) {
|
321
|
+
const userAttr = {
|
322
|
+
UserId: user.UserId,
|
323
|
+
UserName: user.UserName,
|
324
|
+
FullName: user?.FullName || null,
|
325
|
+
IDNo: user?.IdNo || null,
|
326
|
+
IDType: user?.IdType || null,
|
327
|
+
ContactNo: user?.ContactNo || null,
|
328
|
+
Email: user.Email,
|
329
|
+
Password: user.Password,
|
330
|
+
Status: user.Status,
|
331
|
+
DefaultPasswordChangedYN: user.DefaultPasswordChangedYN,
|
332
|
+
FirstLoginAt: user.FirstLoginAt,
|
333
|
+
LastLoginAt: user.LastLoginAt,
|
334
|
+
MFAEnabled: user.MFAEnabled,
|
335
|
+
MFAConfig: user.MFAConfig,
|
336
|
+
RecoveryEmail: user.RecoveryEmail,
|
337
|
+
FailedLoginAttemptCount: user.FailedLoginAttemptCount,
|
338
|
+
LastFailedLoginAt: user.LastFailedLoginAt,
|
339
|
+
LastPasswordChangedAt: user.LastPasswordChangedAt,
|
340
|
+
NeedToChangePasswordYN: user.NeedToChangePasswordYN,
|
341
|
+
CreatedById: user.CreatedById,
|
342
|
+
CreatedAt: user.CreatedAt,
|
343
|
+
UpdatedById: user.UpdatedById,
|
344
|
+
UpdatedAt: user.UpdatedAt,
|
345
|
+
staffs: user?.Staff || null,
|
346
|
+
};
|
347
|
+
this.UserId = userAttr.UserId;
|
348
|
+
this.FullName = userAttr.FullName;
|
349
|
+
this.IDNo = userAttr.IDNo;
|
350
|
+
this.Email = userAttr.Email;
|
351
|
+
this.ContactNo = userAttr.ContactNo;
|
352
|
+
this.Password = userAttr.Password;
|
353
|
+
this.Status = userAttr.Status;
|
354
|
+
this.DefaultPasswordChangedYN = userAttr.DefaultPasswordChangedYN;
|
355
|
+
this.FirstLoginAt = userAttr.FirstLoginAt;
|
356
|
+
this.LastLoginAt = userAttr.LastLoginAt;
|
357
|
+
this.MFAEnabled = userAttr.MFAEnabled;
|
358
|
+
this.MFAConfig = userAttr.MFAConfig;
|
359
|
+
this.RecoveryEmail = userAttr.RecoveryEmail;
|
360
|
+
this.FailedLoginAttemptCount = userAttr.FailedLoginAttemptCount;
|
361
|
+
this.LastFailedLoginAt = userAttr.LastFailedLoginAt;
|
362
|
+
this.LastPasswordChangedAt = userAttr.LastPasswordChangedAt;
|
363
|
+
this.NeedToChangePasswordYN = userAttr.NeedToChangePasswordYN;
|
364
|
+
this.CreatedById = userAttr.CreatedById;
|
365
|
+
this.CreatedAt = userAttr.CreatedAt;
|
366
|
+
this.UpdatedById = userAttr.UpdatedById;
|
367
|
+
this.UpdatedAt = userAttr.UpdatedAt;
|
368
|
+
this.staffs = userAttr.staffs;
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
throw new general_1.ClassError('User', 'UserErrMsg0X', 'Invalid Credentials');
|
372
|
+
}
|
373
|
+
}
|
374
|
+
if (this.ObjectId && this.Email !== email) {
|
375
|
+
throw new Error('Invalid credentials.');
|
376
|
+
}
|
377
|
+
const check2FA = await User.check2FA(this, dbTransaction);
|
378
|
+
try {
|
379
|
+
const system = await User._SystemRepository.findOne({
|
380
|
+
where: {
|
381
|
+
SystemCode: systemCode,
|
382
|
+
Status: 'Active',
|
383
|
+
},
|
384
|
+
});
|
385
|
+
if (!system) {
|
386
|
+
throw new Error('Invalid credentials.');
|
387
|
+
}
|
388
|
+
const passwordHashService = new password_hash_service_1.PasswordHashService();
|
389
|
+
const isPasswordValid = await passwordHashService.verify(password, this.Password);
|
390
|
+
if (!isPasswordValid) {
|
391
|
+
throw new Error('Invalid credentials.');
|
392
|
+
}
|
393
|
+
await this.checkSystemAccess(this.UserId, system.SystemCode, dbTransaction);
|
394
|
+
if (this.Status === enum_1.UserStatus.LOCKED) {
|
395
|
+
const isReleaseLock = User.shouldReleaseLock(this.LastFailedLoginAt);
|
396
|
+
if (isReleaseLock) {
|
397
|
+
await User.releaseLock(this.UserId, dbTransaction);
|
398
|
+
this.Status = enum_1.UserStatus.ACTIVE;
|
399
|
+
}
|
400
|
+
else {
|
401
|
+
throw new Error('Invalid credentials.');
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
catch (error) {
|
406
|
+
await this.incrementFailedLoginAttemptCount(dbTransaction);
|
407
|
+
}
|
408
|
+
const system = await User._SystemRepository.findOne({
|
409
|
+
where: {
|
410
|
+
SystemCode: systemCode,
|
411
|
+
},
|
412
|
+
});
|
413
|
+
await this.alertNewLogin(this.ObjectId, system.SystemCode, ipAddress);
|
414
|
+
this.FailedLoginAttemptCount = 0;
|
415
|
+
this.LastLoginAt = new Date();
|
416
|
+
if (!this.FirstLoginAt) {
|
417
|
+
this.FirstLoginAt = new Date();
|
418
|
+
}
|
419
|
+
await User._Repository.update({
|
420
|
+
FullName: this.FullName,
|
421
|
+
UserName: this.UserName,
|
422
|
+
IDNo: this.IDNo,
|
423
|
+
Email: this.Email,
|
424
|
+
ContactNo: this.ContactNo,
|
425
|
+
Password: this.Password,
|
426
|
+
Status: this.Status,
|
427
|
+
DefaultPasswordChangedYN: this.DefaultPasswordChangedYN,
|
428
|
+
FirstLoginAt: this.FirstLoginAt,
|
429
|
+
LastLoginAt: this.LastLoginAt,
|
430
|
+
MFAEnabled: this.MFAEnabled,
|
431
|
+
MFAConfig: this.MFAConfig,
|
432
|
+
RecoveryEmail: this.RecoveryEmail,
|
433
|
+
FailedLoginAttemptCount: this.FailedLoginAttemptCount,
|
434
|
+
LastFailedLoginAt: this.LastFailedLoginAt,
|
435
|
+
LastPasswordChangedAt: this.LastPasswordChangedAt,
|
436
|
+
NeedToChangePasswordYN: this.NeedToChangePasswordYN,
|
437
|
+
}, {
|
438
|
+
where: {
|
439
|
+
UserId: this.UserId,
|
440
|
+
},
|
441
|
+
transaction: dbTransaction,
|
442
|
+
});
|
443
|
+
const userSession = await this._SessionService.retrieveUserSession(this.ObjectId);
|
444
|
+
const systemLogin = userSession.systemLogins.find((system) => system.code === systemCode);
|
445
|
+
const sessionId = (0, crypto_1.randomUUID)();
|
446
|
+
if (systemLogin) {
|
447
|
+
const privileges = await this.getPrivileges(system.SystemCode, dbTransaction);
|
448
|
+
systemLogin.sessionId = sessionId;
|
449
|
+
systemLogin.privileges = privileges;
|
450
|
+
userSession.systemLogins.map((system) => system.code === systemCode ? systemLogin : system);
|
451
|
+
}
|
452
|
+
else {
|
453
|
+
const newLogin = {
|
454
|
+
id: system.SystemCode,
|
455
|
+
code: system.SystemCode,
|
456
|
+
sessionId: sessionId,
|
457
|
+
privileges: await this.getPrivileges(system.SystemCode, dbTransaction),
|
458
|
+
};
|
459
|
+
userSession.systemLogins.push(newLogin);
|
460
|
+
}
|
461
|
+
this._SessionService.setUserSession(this.ObjectId, userSession);
|
462
|
+
await User._LoginHistoryRepository.create({
|
463
|
+
UserId: this.UserId,
|
464
|
+
SystemCode: system.SystemCode,
|
465
|
+
OriginIp: ipAddress,
|
466
|
+
CreatedAt: new Date(),
|
467
|
+
LoginStatus: login_status_enum_1.LoginStatusEnum.SUCCESS,
|
468
|
+
}, {
|
469
|
+
transaction: dbTransaction,
|
470
|
+
});
|
471
|
+
const is2FAEnabledYN = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'is2FAEnabledYN');
|
472
|
+
const loginUser = await login_user_1.LoginUser.init(this.SessionService, this.UserId, dbTransaction);
|
473
|
+
if (is2FAEnabledYN === 'Y') {
|
474
|
+
loginUser.session.Id = `${this.UserId}:`;
|
475
|
+
}
|
476
|
+
else {
|
477
|
+
loginUser.session.Id = `${this.UserId}:${sessionId}`;
|
478
|
+
}
|
479
|
+
return loginUser;
|
480
|
+
}
|
481
|
+
catch (error) {
|
482
|
+
if (this.ObjectId) {
|
483
|
+
await User._LoginHistoryRepository.create({
|
484
|
+
UserId: this.UserId,
|
485
|
+
SystemCode: systemCode,
|
486
|
+
OriginIp: ipAddress,
|
487
|
+
LoginStatus: login_status_enum_1.LoginStatusEnum.FAILURE,
|
488
|
+
CreatedAt: new Date(),
|
489
|
+
}, {
|
490
|
+
transaction: dbTransaction,
|
491
|
+
});
|
492
|
+
}
|
493
|
+
throw error;
|
494
|
+
}
|
495
|
+
}
|
496
|
+
async checkSystemAccess(userId, systemCode, dbTransaction) {
|
497
|
+
try {
|
498
|
+
let isUserHaveAccess = false;
|
499
|
+
const systemAccess = await User._UserSystemAccessRepo.findOne({
|
500
|
+
where: {
|
501
|
+
UserId: userId,
|
502
|
+
SystemCode: systemCode,
|
503
|
+
Status: 'Active',
|
504
|
+
},
|
505
|
+
dbTransaction,
|
506
|
+
});
|
507
|
+
if (systemAccess) {
|
508
|
+
isUserHaveAccess = true;
|
509
|
+
}
|
510
|
+
else {
|
511
|
+
const userGroups = await User._UserGroupRepo.findAll({
|
512
|
+
where: {
|
513
|
+
UserId: userId,
|
514
|
+
InheritGroupAccessYN: 'Y',
|
515
|
+
Status: 'Active',
|
516
|
+
},
|
517
|
+
include: [
|
518
|
+
{
|
519
|
+
model: group_entity_1.default,
|
520
|
+
},
|
521
|
+
],
|
522
|
+
dbTransaction,
|
523
|
+
});
|
524
|
+
for (const usergroup of userGroups) {
|
525
|
+
const group = usergroup.Group;
|
526
|
+
const groupSystemAccess = await User.getInheritedSystemAccess(dbTransaction, group);
|
527
|
+
for (const system of groupSystemAccess) {
|
528
|
+
if (system.SystemCode === systemCode) {
|
529
|
+
isUserHaveAccess = true;
|
530
|
+
break;
|
531
|
+
}
|
532
|
+
}
|
533
|
+
}
|
534
|
+
}
|
535
|
+
if (!isUserHaveAccess) {
|
536
|
+
throw new Error("User don't have access to the system.");
|
537
|
+
}
|
538
|
+
}
|
539
|
+
catch (error) {
|
540
|
+
throw error;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
async checkPrivileges(systemCode, privilegeName) {
|
544
|
+
try {
|
545
|
+
if (!this.ObjectId) {
|
546
|
+
throw new Error('ObjectId(UserId) is not set');
|
547
|
+
}
|
548
|
+
const userSession = await this._SessionService.retrieveUserSession(this.ObjectId);
|
549
|
+
const systemLogin = userSession.systemLogins.find((system) => system.code === systemCode);
|
550
|
+
if (!systemLogin) {
|
551
|
+
return false;
|
552
|
+
}
|
553
|
+
const privileges = systemLogin.privileges;
|
554
|
+
const hasPrivilege = privileges.includes(privilegeName);
|
555
|
+
return hasPrivilege;
|
556
|
+
}
|
557
|
+
catch (error) {
|
558
|
+
throw error;
|
559
|
+
}
|
560
|
+
}
|
561
|
+
async alertNewLogin(userId, systemCode, ipAddress) {
|
562
|
+
try {
|
563
|
+
const userLogins = await User._LoginHistoryRepository.findAll({
|
564
|
+
where: {
|
565
|
+
UserId: userId,
|
566
|
+
SystemCode: systemCode,
|
567
|
+
},
|
568
|
+
});
|
569
|
+
const gotPreviousLogins = userLogins?.length !== 0;
|
570
|
+
let ipFound = undefined;
|
571
|
+
if (gotPreviousLogins) {
|
572
|
+
ipFound = userLogins.find((item) => item.OriginIp === ipAddress);
|
573
|
+
}
|
574
|
+
}
|
575
|
+
catch (error) {
|
576
|
+
throw error;
|
577
|
+
}
|
578
|
+
}
|
579
|
+
async getPrivileges(systemCode, dbTransaction) {
|
580
|
+
try {
|
581
|
+
const system = await User._SystemRepository.findOne({
|
582
|
+
where: {
|
583
|
+
SystemCode: systemCode,
|
584
|
+
},
|
585
|
+
transaction: dbTransaction,
|
586
|
+
});
|
587
|
+
if (!system) {
|
588
|
+
throw new Error('Invalid system code.');
|
589
|
+
}
|
590
|
+
const userPrivileges = await this.getUserPersonalPrivileges(systemCode, dbTransaction);
|
591
|
+
const objectPrivileges = await this.getObjectPrivileges(systemCode, dbTransaction);
|
592
|
+
const userGroupOwnByUser = await User._UserGroupRepo.findAll({
|
593
|
+
where: {
|
594
|
+
UserId: this.UserId,
|
595
|
+
InheritGroupSystemAccessYN: 'Y',
|
596
|
+
InheritGroupPrivilegeYN: 'Y',
|
597
|
+
Status: 'Active',
|
598
|
+
},
|
599
|
+
include: [
|
600
|
+
{
|
601
|
+
model: group_entity_1.default,
|
602
|
+
where: {
|
603
|
+
Status: 'Active',
|
604
|
+
},
|
605
|
+
include: [
|
606
|
+
{
|
607
|
+
model: group_system_access_entity_1.default,
|
608
|
+
where: {
|
609
|
+
SystemCode: systemCode,
|
610
|
+
},
|
611
|
+
},
|
612
|
+
],
|
613
|
+
},
|
614
|
+
],
|
615
|
+
transaction: dbTransaction,
|
616
|
+
});
|
617
|
+
let groupsPrivileges = [];
|
618
|
+
for (const userGroup of userGroupOwnByUser) {
|
619
|
+
const gp = await this.getInheritedPrivileges(userGroup.GroupCode, systemCode, dbTransaction);
|
620
|
+
groupsPrivileges = [...groupsPrivileges, ...gp];
|
621
|
+
}
|
622
|
+
const privileges = [
|
623
|
+
...userPrivileges,
|
624
|
+
...objectPrivileges,
|
625
|
+
...groupsPrivileges,
|
626
|
+
];
|
627
|
+
return privileges;
|
628
|
+
}
|
629
|
+
catch (error) {
|
630
|
+
throw error;
|
631
|
+
}
|
632
|
+
}
|
633
|
+
async getInheritedPrivileges(groupCode, systemCode, dbTransaction) {
|
634
|
+
try {
|
635
|
+
const group = await User._GroupRepo.findOne({
|
636
|
+
where: {
|
637
|
+
GroupCode: groupCode,
|
638
|
+
Status: 'Active',
|
639
|
+
},
|
640
|
+
include: [
|
641
|
+
{
|
642
|
+
model: group_privilege_entity_1.default,
|
643
|
+
where: {
|
644
|
+
Status: 'Active',
|
645
|
+
},
|
646
|
+
include: [
|
647
|
+
{
|
648
|
+
model: system_privilege_entity_1.default,
|
649
|
+
where: {
|
650
|
+
SystemCode: systemCode,
|
651
|
+
Status: 'Active',
|
652
|
+
},
|
653
|
+
},
|
654
|
+
],
|
655
|
+
},
|
656
|
+
],
|
657
|
+
transaction: dbTransaction,
|
658
|
+
});
|
659
|
+
const objectPrivileges = await User._GroupObjectPrivilegeRepo.findAll({
|
660
|
+
where: {
|
661
|
+
GroupCode: groupCode,
|
662
|
+
},
|
663
|
+
include: {
|
664
|
+
model: system_privilege_entity_1.default,
|
665
|
+
where: {
|
666
|
+
SystemCode: systemCode,
|
667
|
+
Status: 'Active',
|
668
|
+
},
|
669
|
+
},
|
670
|
+
transaction: dbTransaction,
|
671
|
+
});
|
672
|
+
const gp = group?.GroupPrivileges || [];
|
673
|
+
const op = objectPrivileges || [];
|
674
|
+
let privileges = [];
|
675
|
+
const groupPrivileges = [];
|
676
|
+
for (const groupPrivilege of gp) {
|
677
|
+
groupPrivileges.push(groupPrivilege.Privilege.PrivilegeCode);
|
678
|
+
}
|
679
|
+
const ops = [];
|
680
|
+
for (const objectPrivilege of op) {
|
681
|
+
ops.push(objectPrivilege.Privilege.PrivilegeCode);
|
682
|
+
}
|
683
|
+
privileges = [...privileges, ...groupPrivileges, ...ops];
|
684
|
+
if (group?.ParentGroupCode && group?.InheritParentPrivilegeYN === 'Y') {
|
685
|
+
const parentGroupPrivileges = await this.getInheritedPrivileges(group.ParentGroupCode, systemCode, dbTransaction);
|
686
|
+
privileges = [...privileges, ...parentGroupPrivileges];
|
687
|
+
}
|
688
|
+
return privileges;
|
689
|
+
}
|
690
|
+
catch (error) {
|
691
|
+
throw error;
|
692
|
+
}
|
693
|
+
}
|
694
|
+
async getUserPersonalPrivileges(systemCode, dbTransaction) {
|
695
|
+
try {
|
696
|
+
const userPrivileges = (await User._UserPrivilegeRepo.findAll({
|
697
|
+
where: {
|
698
|
+
UserId: this.UserId,
|
699
|
+
Status: 'Active',
|
700
|
+
},
|
701
|
+
include: {
|
702
|
+
model: system_privilege_entity_1.default,
|
703
|
+
where: {
|
704
|
+
SystemCode: systemCode,
|
705
|
+
Status: 'Active',
|
706
|
+
},
|
707
|
+
},
|
708
|
+
transaction: dbTransaction,
|
709
|
+
})) || [];
|
710
|
+
const privileges = userPrivileges.map((u) => u.Privilege.PrivilegeCode);
|
711
|
+
return privileges;
|
712
|
+
}
|
713
|
+
catch (error) {
|
714
|
+
throw error;
|
715
|
+
}
|
716
|
+
}
|
717
|
+
async getObjectPrivileges(systemCode, dbTransaction) {
|
718
|
+
try {
|
719
|
+
const userObjectPrivileges = (await User._UserObjectPrivilegeRepo.findAll({
|
720
|
+
where: {
|
721
|
+
UserId: this.UserId,
|
722
|
+
},
|
723
|
+
include: {
|
724
|
+
model: system_privilege_entity_1.default,
|
725
|
+
where: {
|
726
|
+
SystemCode: systemCode,
|
727
|
+
Status: 'Active',
|
728
|
+
},
|
729
|
+
},
|
730
|
+
transaction: dbTransaction,
|
731
|
+
})) || [];
|
732
|
+
const privilegesCodes = userObjectPrivileges.map((u) => u.Privilege.PrivilegeCode);
|
733
|
+
return privilegesCodes;
|
734
|
+
}
|
735
|
+
catch (error) {
|
736
|
+
throw error;
|
737
|
+
}
|
738
|
+
}
|
739
|
+
static async checkUserInfoDuplicated(dbTransaction, query) {
|
740
|
+
try {
|
741
|
+
const { Email, UserName, IdType, IdNo, ContactNo } = query;
|
742
|
+
const where = {
|
743
|
+
[sequelize_1.Op.or]: {},
|
744
|
+
};
|
745
|
+
if (Email) {
|
746
|
+
where[sequelize_1.Op.or]['Email'] = Email;
|
747
|
+
}
|
748
|
+
if (UserName) {
|
749
|
+
where[sequelize_1.Op.or]['UserName'] = UserName;
|
750
|
+
}
|
751
|
+
if (IdType && IdNo) {
|
752
|
+
where[sequelize_1.Op.and] = [{ IdType: IdType }, { IdNo: IdNo }];
|
753
|
+
}
|
754
|
+
if (ContactNo) {
|
755
|
+
where[sequelize_1.Op.or]['ContactNo'] = ContactNo;
|
756
|
+
}
|
757
|
+
const user = await User._Repository.findAll({
|
758
|
+
where,
|
759
|
+
transaction: dbTransaction,
|
760
|
+
});
|
761
|
+
if (user && user.length > 0) {
|
762
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'User info already exists');
|
763
|
+
}
|
764
|
+
}
|
765
|
+
catch (error) {
|
766
|
+
throw error;
|
767
|
+
}
|
768
|
+
}
|
769
|
+
static generateDefaultPassword() {
|
770
|
+
try {
|
771
|
+
const passwordPolicy = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'passwordPolicy');
|
772
|
+
if (!passwordPolicy ||
|
773
|
+
!passwordPolicy.maxLen ||
|
774
|
+
!passwordPolicy.minLen ||
|
775
|
+
!passwordPolicy.nonAcceptableChar ||
|
776
|
+
!passwordPolicy.numOfCapitalLetters ||
|
777
|
+
!passwordPolicy.numOfNumbers ||
|
778
|
+
!passwordPolicy.numOfSpecialChars) {
|
779
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Missing password policy. Please set in config file.');
|
780
|
+
}
|
781
|
+
if (passwordPolicy.numOfCapitalLetters +
|
782
|
+
passwordPolicy.numOfNumbers +
|
783
|
+
passwordPolicy.numOfSpecialChars >
|
784
|
+
passwordPolicy.maxLen) {
|
785
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Password policy is invalid. Please set in config file.');
|
786
|
+
}
|
787
|
+
const { maxLen, minLen, nonAcceptableChar, numOfCapitalLetters, numOfNumbers, numOfSpecialChars, } = passwordPolicy;
|
788
|
+
const passwordLength = Math.floor(Math.random() * (maxLen - minLen + 1)) + minLen;
|
789
|
+
const words = 'abcdefghijklmnopqrstuvwxyz';
|
790
|
+
const capitalLetters = words.toUpperCase();
|
791
|
+
const numbers = '0123456789';
|
792
|
+
const specialChars = '!@#$%^&*()_+-={}[]|:;"<>,.?/~`';
|
793
|
+
const nonAcceptableChars = nonAcceptableChar.split(',');
|
794
|
+
const filteredWords = words
|
795
|
+
.split('')
|
796
|
+
.filter((word) => !nonAcceptableChars.includes(word));
|
797
|
+
const filteredCapitalLetters = capitalLetters
|
798
|
+
.split('')
|
799
|
+
.filter((word) => !nonAcceptableChars.includes(word));
|
800
|
+
const filteredNumbers = numbers
|
801
|
+
.split('')
|
802
|
+
.filter((word) => !nonAcceptableChars.includes(word));
|
803
|
+
const filteredSpecialChars = specialChars
|
804
|
+
.split('')
|
805
|
+
.filter((word) => !nonAcceptableChars.includes(word));
|
806
|
+
const generatedCapitalLetters = [];
|
807
|
+
const generatedNumbers = [];
|
808
|
+
const generatedSpecialChars = [];
|
809
|
+
const generatedWords = [];
|
810
|
+
for (let i = 0; i < numOfCapitalLetters; i++) {
|
811
|
+
const randomIndex = Math.floor(Math.random() * filteredCapitalLetters.length);
|
812
|
+
generatedCapitalLetters.push(filteredCapitalLetters[randomIndex]);
|
813
|
+
}
|
814
|
+
for (let i = 0; i < numOfNumbers; i++) {
|
815
|
+
const randomIndex = Math.floor(Math.random() * filteredNumbers.length);
|
816
|
+
generatedNumbers.push(filteredNumbers[randomIndex]);
|
817
|
+
}
|
818
|
+
for (let i = 0; i < numOfSpecialChars; i++) {
|
819
|
+
const randomIndex = Math.floor(Math.random() * filteredSpecialChars.length);
|
820
|
+
generatedSpecialChars.push(filteredSpecialChars[randomIndex]);
|
821
|
+
}
|
822
|
+
for (let i = 0; i <
|
823
|
+
passwordLength -
|
824
|
+
(numOfCapitalLetters + numOfNumbers + numOfSpecialChars); i++) {
|
825
|
+
const randomIndex = Math.floor(Math.random() * filteredWords.length);
|
826
|
+
generatedWords.push(filteredWords[randomIndex]);
|
827
|
+
}
|
828
|
+
let generatedPassword = '';
|
829
|
+
const allGeneratedChars = generatedCapitalLetters.concat(generatedNumbers, generatedSpecialChars, generatedWords);
|
830
|
+
allGeneratedChars.sort(() => Math.random() - 0.5);
|
831
|
+
generatedPassword = allGeneratedChars.join('');
|
832
|
+
return generatedPassword;
|
833
|
+
}
|
834
|
+
catch (error) {
|
835
|
+
throw error;
|
836
|
+
}
|
837
|
+
}
|
838
|
+
static async setPassword(dbTransaction, user, password) {
|
839
|
+
try {
|
840
|
+
const passwordPolicy = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'passwordPolicy');
|
841
|
+
if (!passwordPolicy ||
|
842
|
+
!passwordPolicy.maxLen ||
|
843
|
+
!passwordPolicy.minLen ||
|
844
|
+
!passwordPolicy.nonAcceptableChar ||
|
845
|
+
!passwordPolicy.numOfCapitalLetters ||
|
846
|
+
!passwordPolicy.numOfNumbers ||
|
847
|
+
!passwordPolicy.numOfSpecialChars) {
|
848
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Missing password policy. Please set in config file.');
|
849
|
+
}
|
850
|
+
try {
|
851
|
+
if (password.length < passwordPolicy.minLen) {
|
852
|
+
throw Error('Password is too short');
|
853
|
+
}
|
854
|
+
if (password.length > passwordPolicy.maxLen) {
|
855
|
+
throw Error('Password is too long');
|
856
|
+
}
|
857
|
+
const nonAcceptableChars = passwordPolicy.nonAcceptableChar.split(',');
|
858
|
+
const nonAcceptableCharsFound = nonAcceptableChars.some((char) => password.includes(char));
|
859
|
+
if (nonAcceptableCharsFound) {
|
860
|
+
throw Error('Password contains unacceptable characters');
|
861
|
+
}
|
862
|
+
const capitalLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
863
|
+
const numOfCapitalLetters = passwordPolicy.numOfCapitalLetters;
|
864
|
+
const capitalLettersFound = capitalLetters
|
865
|
+
.split('')
|
866
|
+
.filter((char) => password.includes(char)).length;
|
867
|
+
if (capitalLettersFound < numOfCapitalLetters) {
|
868
|
+
throw Error('Password does not contain enough capital letters');
|
869
|
+
}
|
870
|
+
const numbers = '0123456789';
|
871
|
+
const numOfNumbers = passwordPolicy.numOfNumbers;
|
872
|
+
const numbersFound = numbers
|
873
|
+
.split('')
|
874
|
+
.filter((char) => password.includes(char)).length;
|
875
|
+
if (numbersFound < numOfNumbers) {
|
876
|
+
throw Error('Password does not contain enough numbers');
|
877
|
+
}
|
878
|
+
const specialChars = '!@#$%^&*()_+-={}[]|:;"<>,.?/~`';
|
879
|
+
const numOfSpecialChars = passwordPolicy.numOfSpecialChars;
|
880
|
+
const specialCharsFound = specialChars
|
881
|
+
.split('')
|
882
|
+
.filter((char) => password.includes(char)).length;
|
883
|
+
if (specialCharsFound < numOfSpecialChars) {
|
884
|
+
throw Error('Password does not contain enough special characters');
|
885
|
+
}
|
886
|
+
}
|
887
|
+
catch (error) {
|
888
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', "Your password doesn't meet security requirements. Try using a mix of uppercase and lowercase letters, numbers, and symbols.");
|
889
|
+
}
|
890
|
+
const passwordHashService = new password_hash_service_1.PasswordHashService();
|
891
|
+
const hashedPassword = await passwordHashService.hashPassword(password);
|
892
|
+
user._Password = hashedPassword;
|
893
|
+
return user;
|
894
|
+
}
|
895
|
+
catch (error) {
|
896
|
+
throw error;
|
897
|
+
}
|
898
|
+
}
|
899
|
+
async generateAuthorizationToken() {
|
900
|
+
const plaintextToken = (0, crypto_1.randomBytes)(32).toString('hex');
|
901
|
+
const hashedToken = (0, crypto_1.createHash)('sha256')
|
902
|
+
.update(plaintextToken)
|
903
|
+
.digest('hex');
|
904
|
+
this._SessionService.setAuthorizationCode(hashedToken, this.ObjectId, 60 * 60 * 24);
|
905
|
+
return { plaintextToken, hashedToken };
|
906
|
+
}
|
907
|
+
async validateAuthorizationToken(autorizationToken) {
|
908
|
+
try {
|
909
|
+
const hashedSubmittedToken = (0, crypto_1.createHash)('sha256')
|
910
|
+
.update(autorizationToken)
|
911
|
+
.digest('hex');
|
912
|
+
const userId = await this._SessionService.retrieveAuthorizationCode(hashedSubmittedToken);
|
913
|
+
if (!userId) {
|
914
|
+
return null;
|
915
|
+
}
|
916
|
+
await this._SessionService.deleteAuthorizationCode(hashedSubmittedToken);
|
917
|
+
return userId;
|
918
|
+
}
|
919
|
+
catch (error) {
|
920
|
+
throw error;
|
921
|
+
}
|
922
|
+
}
|
923
|
+
static async resetPassword(sessionService, autorizationToken, password, dbTransaction) {
|
924
|
+
try {
|
925
|
+
const hashedSubmittedToken = (0, crypto_1.createHash)('sha256')
|
926
|
+
.update(autorizationToken)
|
927
|
+
.digest('hex');
|
928
|
+
const userId = await sessionService.retrieveAuthorizationCode(hashedSubmittedToken);
|
929
|
+
if (!userId) {
|
930
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid token', 'setupFirstPassword', 401);
|
931
|
+
}
|
932
|
+
await sessionService.deleteAuthorizationCode(hashedSubmittedToken);
|
933
|
+
console.log(`Token verified for user: ${userId}`);
|
934
|
+
const user = await User.init(sessionService, parseInt(userId), dbTransaction);
|
935
|
+
await User.setPassword(dbTransaction, user, password);
|
936
|
+
await User._Repository.update({
|
937
|
+
Password: user._Password,
|
938
|
+
DefaultPasswordChangedYN: yn_enum_1.YN.Yes,
|
939
|
+
NeedToChangePasswordYN: yn_enum_1.YN.No,
|
940
|
+
}, {
|
941
|
+
where: {
|
942
|
+
UserId: user.UserId,
|
943
|
+
},
|
944
|
+
transaction: dbTransaction,
|
945
|
+
});
|
946
|
+
}
|
947
|
+
catch (error) {
|
948
|
+
throw error;
|
949
|
+
}
|
950
|
+
}
|
951
|
+
static async create(loginUser, dbTransaction, user) {
|
952
|
+
try {
|
953
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
954
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'User - Create');
|
955
|
+
if (!isPrivileged) {
|
956
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'You do not have the privilege to create user');
|
957
|
+
}
|
958
|
+
if (!user.Email && !user.UserName) {
|
959
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Email and Username is required');
|
960
|
+
}
|
961
|
+
await User.checkUserInfoDuplicated(dbTransaction, {
|
962
|
+
Email: user.Email,
|
963
|
+
UserName: user.UserName,
|
964
|
+
IdType: user.IDType,
|
965
|
+
IdNo: user.IDNo,
|
966
|
+
ContactNo: user.ContactNo,
|
967
|
+
});
|
968
|
+
const defaultPassword = User.generateDefaultPassword();
|
969
|
+
user = await User.setPassword(dbTransaction, user, defaultPassword);
|
970
|
+
const userInfo = {
|
971
|
+
UserName: user.UserName,
|
972
|
+
FullName: user.FullName,
|
973
|
+
IDNo: user.IDNo,
|
974
|
+
IDType: user.IDType,
|
975
|
+
Email: user.Email,
|
976
|
+
ContactNo: user.ContactNo,
|
977
|
+
Password: user.Password,
|
978
|
+
Status: enum_1.UserStatus.ACTIVE,
|
979
|
+
FirstLoginAt: null,
|
980
|
+
LastLoginAt: null,
|
981
|
+
MFAEnabled: null,
|
982
|
+
MFAConfig: null,
|
983
|
+
RecoveryEmail: null,
|
984
|
+
FailedLoginAttemptCount: 0,
|
985
|
+
LastFailedLoginAt: null,
|
986
|
+
LastPasswordChangedAt: null,
|
987
|
+
DefaultPasswordChangedYN: yn_enum_1.YN.No,
|
988
|
+
NeedToChangePasswordYN: yn_enum_1.YN.Yes,
|
989
|
+
CreatedById: loginUser.UserId,
|
990
|
+
CreatedAt: new Date(),
|
991
|
+
UpdatedById: loginUser.UserId,
|
992
|
+
UpdatedAt: new Date(),
|
993
|
+
UserId: null,
|
994
|
+
};
|
995
|
+
const newUser = await User._Repository.create({
|
996
|
+
Email: userInfo.Email,
|
997
|
+
UserName: userInfo.UserName,
|
998
|
+
FullName: userInfo.FullName,
|
999
|
+
IdNo: userInfo.IDNo,
|
1000
|
+
IdType: userInfo.IDType,
|
1001
|
+
Password: userInfo.Password,
|
1002
|
+
Status: userInfo.Status,
|
1003
|
+
DefaultPasswordChangedYN: userInfo.DefaultPasswordChangedYN,
|
1004
|
+
FirstLoginAt: userInfo.FirstLoginAt,
|
1005
|
+
LastLoginAt: userInfo.LastLoginAt,
|
1006
|
+
MFAEnabled: userInfo.MFAEnabled,
|
1007
|
+
MFAConfig: userInfo.MFAConfig,
|
1008
|
+
RecoveryEmail: userInfo.RecoveryEmail,
|
1009
|
+
FailedLoginAttemptCount: userInfo.FailedLoginAttemptCount,
|
1010
|
+
LastFailedLoginAt: userInfo.LastFailedLoginAt,
|
1011
|
+
LastPasswordChangedAt: userInfo.LastPasswordChangedAt,
|
1012
|
+
NeedToChangePasswordYN: userInfo.NeedToChangePasswordYN,
|
1013
|
+
CreatedById: userInfo.CreatedById,
|
1014
|
+
CreatedAt: userInfo.CreatedAt,
|
1015
|
+
UpdatedById: userInfo.UpdatedById,
|
1016
|
+
UpdatedAt: userInfo.UpdatedAt,
|
1017
|
+
}, {
|
1018
|
+
transaction: dbTransaction,
|
1019
|
+
});
|
1020
|
+
userInfo.UserId = newUser.UserId;
|
1021
|
+
const userToBeCreated = new User(loginUser.SessionService, dbTransaction, userInfo);
|
1022
|
+
const activity = new activity_history_1.Activity();
|
1023
|
+
activity.ActivityId = activity.createId();
|
1024
|
+
activity.Action = activity_history_1.ActionEnum.CREATE;
|
1025
|
+
activity.Description = 'Create User';
|
1026
|
+
activity.EntityType = 'LoginUser';
|
1027
|
+
activity.EntityId = newUser.UserId.toString();
|
1028
|
+
activity.EntityValueBefore = JSON.stringify({});
|
1029
|
+
activity.EntityValueAfter = JSON.stringify(newUser.get({ plain: true }));
|
1030
|
+
await activity.create(loginUser.ObjectId, dbTransaction);
|
1031
|
+
return userToBeCreated;
|
1032
|
+
}
|
1033
|
+
catch (error) {
|
1034
|
+
throw error;
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
async incrementFailedLoginAttemptCount(dbTransaction) {
|
1038
|
+
const maxFailedLoginAttempts = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'maxFailedLoginAttempts');
|
1039
|
+
const autoReleaseYN = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'autoReleaseYN');
|
1040
|
+
if (!maxFailedLoginAttempts || !autoReleaseYN) {
|
1041
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Missing maxFailedLoginAttempts and or autoReleaseYN. Please set in config file.');
|
1042
|
+
}
|
1043
|
+
const FailedLoginAttemptCount = this.FailedLoginAttemptCount + 1;
|
1044
|
+
const LastFailedLoginAt = new Date();
|
1045
|
+
if (FailedLoginAttemptCount > maxFailedLoginAttempts) {
|
1046
|
+
this.Status = enum_1.UserStatus.LOCKED;
|
1047
|
+
}
|
1048
|
+
await User._Repository.update({
|
1049
|
+
FailedLoginAttemptCount: FailedLoginAttemptCount,
|
1050
|
+
LastFailedLoginAt: LastFailedLoginAt,
|
1051
|
+
Status: this.Status,
|
1052
|
+
}, {
|
1053
|
+
where: {
|
1054
|
+
UserId: this.UserId,
|
1055
|
+
},
|
1056
|
+
transaction: dbTransaction,
|
1057
|
+
});
|
1058
|
+
if (this.Status === enum_1.UserStatus.LOCKED && autoReleaseYN === 'Y') {
|
1059
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Your account has been temporarily locked due to too many failed login attempts, please try again later.');
|
1060
|
+
}
|
1061
|
+
if (this.Status === enum_1.UserStatus.LOCKED && autoReleaseYN === 'N') {
|
1062
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Your account has been locked due to too many failed login attempts, please contact IT Support for instructions on how to unlock your account');
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
static shouldReleaseLock(LastFailedLoginAt) {
|
1066
|
+
const minuteToAutoRelease = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'minuteToAutoRelease');
|
1067
|
+
const autoReleaseYN = config_1.ComponentConfig.getComponentConfigValue('@tomei/sso', 'autoReleaseYN');
|
1068
|
+
if (!minuteToAutoRelease || !autoReleaseYN) {
|
1069
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Missing minuteToAutoRelease and or autoReleaseYN. Please set in config file.');
|
1070
|
+
}
|
1071
|
+
if (autoReleaseYN === 'Y') {
|
1072
|
+
const lastFailedDate = new Date(LastFailedLoginAt);
|
1073
|
+
const currentDate = new Date();
|
1074
|
+
const timeDifferenceInMillis = currentDate.getTime() - lastFailedDate.getTime();
|
1075
|
+
const timeDifferenceInMinutes = timeDifferenceInMillis / (1000 * 60);
|
1076
|
+
if (timeDifferenceInMinutes > +minuteToAutoRelease) {
|
1077
|
+
return true;
|
1078
|
+
}
|
1079
|
+
else {
|
1080
|
+
return false;
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
else if (autoReleaseYN === 'N') {
|
1084
|
+
return false;
|
1085
|
+
}
|
1086
|
+
}
|
1087
|
+
static releaseLock(UserId, dbTransaction) {
|
1088
|
+
this._Repository.update({
|
1089
|
+
FailedLoginAttemptCount: 0,
|
1090
|
+
Status: enum_1.UserStatus.ACTIVE,
|
1091
|
+
}, {
|
1092
|
+
where: {
|
1093
|
+
UserId: UserId,
|
1094
|
+
},
|
1095
|
+
transaction: dbTransaction,
|
1096
|
+
});
|
1097
|
+
}
|
1098
|
+
static async getGroups(loginUser, dbTransaction) {
|
1099
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1100
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'UserGroup - List Own');
|
1101
|
+
if (!isPrivileged) {
|
1102
|
+
throw new Error('You do not have permission to list UserGroup.');
|
1103
|
+
}
|
1104
|
+
const userGroups = await User._UserGroupRepo.findAll({
|
1105
|
+
where: {
|
1106
|
+
UserId: loginUser.ObjectId,
|
1107
|
+
Status: 'Active',
|
1108
|
+
},
|
1109
|
+
include: [{ model: user_entity_1.default, as: 'User' }, { model: group_entity_1.default }],
|
1110
|
+
transaction: dbTransaction,
|
1111
|
+
});
|
1112
|
+
return userGroups;
|
1113
|
+
}
|
1114
|
+
static async getInheritedSystemAccess(dbTransaction, group) {
|
1115
|
+
const dataSystemAccesses = await User._GroupSystemAccessRepo.findAll({
|
1116
|
+
where: {
|
1117
|
+
GroupCode: group.GroupCode,
|
1118
|
+
Status: 'Active',
|
1119
|
+
},
|
1120
|
+
include: [{ model: system_entity_1.default }],
|
1121
|
+
transaction: dbTransaction,
|
1122
|
+
});
|
1123
|
+
let systemAccesses = dataSystemAccesses;
|
1124
|
+
if (group.InheritParentPrivilegeYN === 'Y' && group.ParentGroupCode) {
|
1125
|
+
const GroupCode = group.ParentGroupCode;
|
1126
|
+
const parentGroup = await User._GroupRepo.findByPk(GroupCode, dbTransaction);
|
1127
|
+
const dataParentSystemAccesses = await User.getInheritedSystemAccess(dbTransaction, parentGroup);
|
1128
|
+
const parentSystemAccesses = dataParentSystemAccesses;
|
1129
|
+
systemAccesses = systemAccesses.concat(parentSystemAccesses);
|
1130
|
+
}
|
1131
|
+
return systemAccesses;
|
1132
|
+
}
|
1133
|
+
static async combineSystemAccess(loginUser, dbTransaction, groups) {
|
1134
|
+
const userAccess = await User._UserSystemAccessRepo.findAll({
|
1135
|
+
where: {
|
1136
|
+
UserId: loginUser.ObjectId,
|
1137
|
+
Status: 'Active',
|
1138
|
+
},
|
1139
|
+
include: [{ model: system_entity_1.default }],
|
1140
|
+
transaction: dbTransaction,
|
1141
|
+
});
|
1142
|
+
const groupAccessPromises = groups.map(async (e) => {
|
1143
|
+
if (e.InheritParentSystemAccessYN) {
|
1144
|
+
return await this.getInheritedSystemAccess(dbTransaction, e);
|
1145
|
+
}
|
1146
|
+
else {
|
1147
|
+
return [];
|
1148
|
+
}
|
1149
|
+
});
|
1150
|
+
const groupAccess = (await Promise.all(groupAccessPromises)).flat();
|
1151
|
+
const allAccess = userAccess.concat(groupAccess);
|
1152
|
+
const uniqueAccess = new Set(allAccess.filter((value, index, self) => {
|
1153
|
+
return self.some((prev) => prev.SystemCode === value.SystemCode);
|
1154
|
+
}));
|
1155
|
+
return Array.from(uniqueAccess);
|
1156
|
+
}
|
1157
|
+
static async getSystems(loginUser, dbTransaction) {
|
1158
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1159
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'System – List Own');
|
1160
|
+
if (!isPrivileged) {
|
1161
|
+
throw new Error('You do not have permission to list UserGroup.');
|
1162
|
+
}
|
1163
|
+
const groups = await User.getGroups(loginUser, dbTransaction);
|
1164
|
+
const systemAccess = await User.combineSystemAccess(loginUser, dbTransaction, groups);
|
1165
|
+
const output = [];
|
1166
|
+
if (systemAccess) {
|
1167
|
+
for (let i = 0; i < systemAccess.length; i++) {
|
1168
|
+
const system = await User._SystemRepository.findOne({
|
1169
|
+
where: {
|
1170
|
+
SystemCode: systemAccess[i].SystemCode,
|
1171
|
+
Status: 'Active',
|
1172
|
+
},
|
1173
|
+
});
|
1174
|
+
output.push({
|
1175
|
+
UserSystemAccessId: systemAccess[i].UserSystemAccessId,
|
1176
|
+
UserId: systemAccess[i].UserId,
|
1177
|
+
SystemCode: systemAccess[i].SystemCode,
|
1178
|
+
Status: systemAccess[i].Status,
|
1179
|
+
CreatedById: systemAccess[i].CreatedById,
|
1180
|
+
UpdatedById: systemAccess[i].UpdatedById,
|
1181
|
+
CreatedAt: systemAccess[i].CreatedAt,
|
1182
|
+
UpdatedAt: systemAccess[i].UpdatedAt,
|
1183
|
+
System: system,
|
1184
|
+
});
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
return output;
|
1188
|
+
}
|
1189
|
+
static async check2FA(loginUser, dbTransaction) {
|
1190
|
+
try {
|
1191
|
+
const user = await User._Repository.findOne({
|
1192
|
+
where: {
|
1193
|
+
UserId: loginUser.UserId,
|
1194
|
+
},
|
1195
|
+
transaction: dbTransaction,
|
1196
|
+
});
|
1197
|
+
if (user.MFAEnabled === 1) {
|
1198
|
+
return true;
|
1199
|
+
}
|
1200
|
+
return false;
|
1201
|
+
}
|
1202
|
+
catch (error) {
|
1203
|
+
throw error;
|
1204
|
+
}
|
1205
|
+
}
|
1206
|
+
static async setup2FA(userId, dbTransaction) {
|
1207
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1208
|
+
const user = await User._Repository.findOne({
|
1209
|
+
where: {
|
1210
|
+
UserId: userId,
|
1211
|
+
},
|
1212
|
+
});
|
1213
|
+
if (!user) {
|
1214
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Credentials');
|
1215
|
+
}
|
1216
|
+
const secretCode = speakeasy.generateSecret({ name: 'Tomei SSO' });
|
1217
|
+
let userMFAConfig = null;
|
1218
|
+
if (user?.MFAConfig !== null && typeof user?.MFAConfig === 'string') {
|
1219
|
+
try {
|
1220
|
+
userMFAConfig = JSON.parse(user?.MFAConfig);
|
1221
|
+
}
|
1222
|
+
catch (error) {
|
1223
|
+
console.error('Invalid JSON string on MFAConfig:', error);
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
const MFAConfig = {
|
1227
|
+
totp: {
|
1228
|
+
enabled: true,
|
1229
|
+
secret: secretCode.base32,
|
1230
|
+
issuer: systemCode,
|
1231
|
+
},
|
1232
|
+
sms: {
|
1233
|
+
enabled: userMFAConfig?.sms?.enable || false,
|
1234
|
+
phoneNumber: userMFAConfig?.sms?.phoneNumber || '',
|
1235
|
+
},
|
1236
|
+
email: {
|
1237
|
+
enabled: userMFAConfig?.email?.enable || false,
|
1238
|
+
emailAddress: userMFAConfig?.email?.emailAddress || '',
|
1239
|
+
},
|
1240
|
+
};
|
1241
|
+
user.MFAEnabled = 0;
|
1242
|
+
user.MFAConfig = JSON.stringify(MFAConfig);
|
1243
|
+
await User._Repository.update({
|
1244
|
+
MFAEnabled: user.MFAEnabled,
|
1245
|
+
MFAConfig: user.MFAConfig,
|
1246
|
+
}, {
|
1247
|
+
where: {
|
1248
|
+
UserId: userId,
|
1249
|
+
},
|
1250
|
+
transaction: dbTransaction,
|
1251
|
+
});
|
1252
|
+
return secretCode.otpauth_url;
|
1253
|
+
}
|
1254
|
+
async verify2FASetup(userId, mfaToken, systemCode, dbTransaction) {
|
1255
|
+
const user = await User._Repository.findOne({
|
1256
|
+
where: {
|
1257
|
+
UserId: userId,
|
1258
|
+
},
|
1259
|
+
});
|
1260
|
+
if (!user) {
|
1261
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Credentials');
|
1262
|
+
}
|
1263
|
+
let userMFAConfig = null;
|
1264
|
+
if (user?.MFAConfig !== null && typeof user?.MFAConfig === 'string') {
|
1265
|
+
try {
|
1266
|
+
userMFAConfig = JSON.parse(user?.MFAConfig);
|
1267
|
+
}
|
1268
|
+
catch (error) {
|
1269
|
+
console.error('Invalid JSON string on MFAConfig:', error);
|
1270
|
+
}
|
1271
|
+
}
|
1272
|
+
const isVerified = await speakeasy.totp.verify({
|
1273
|
+
secret: userMFAConfig.totp.secret,
|
1274
|
+
encoding: 'base32',
|
1275
|
+
token: mfaToken,
|
1276
|
+
});
|
1277
|
+
if (!isVerified) {
|
1278
|
+
return false;
|
1279
|
+
}
|
1280
|
+
user.MFAEnabled = 1;
|
1281
|
+
await user.save({ transaction: dbTransaction });
|
1282
|
+
const userSession = await this._SessionService.retrieveUserSession(`${userId}`);
|
1283
|
+
if (!systemCode) {
|
1284
|
+
systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1285
|
+
}
|
1286
|
+
const systemLogin = userSession.systemLogins.find((e) => e.code === systemCode);
|
1287
|
+
return `${userId}:${systemLogin.sessionId}`;
|
1288
|
+
}
|
1289
|
+
async verify2FACode(userId, mfaToken, systemCode, dbTransaction) {
|
1290
|
+
const user = await User._Repository.findOne({
|
1291
|
+
where: {
|
1292
|
+
UserId: userId,
|
1293
|
+
},
|
1294
|
+
transaction: dbTransaction,
|
1295
|
+
});
|
1296
|
+
if (!user) {
|
1297
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Credentials');
|
1298
|
+
}
|
1299
|
+
let userMFAConfig = null;
|
1300
|
+
if (user?.MFAConfig !== null && typeof user?.MFAConfig === 'string') {
|
1301
|
+
try {
|
1302
|
+
userMFAConfig = JSON.parse(user?.MFAConfig);
|
1303
|
+
}
|
1304
|
+
catch (error) {
|
1305
|
+
console.error('Invalid JSON string on MFAConfig:', error);
|
1306
|
+
}
|
1307
|
+
}
|
1308
|
+
const isVerified = await speakeasy.totp.verify({
|
1309
|
+
secret: userMFAConfig.totp.secret,
|
1310
|
+
encoding: 'base32',
|
1311
|
+
token: mfaToken,
|
1312
|
+
});
|
1313
|
+
if (!isVerified) {
|
1314
|
+
return false;
|
1315
|
+
}
|
1316
|
+
const userSession = await this._SessionService.retrieveUserSession(`${userId}`);
|
1317
|
+
if (!systemCode) {
|
1318
|
+
systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1319
|
+
}
|
1320
|
+
const systemLogin = userSession.systemLogins.find((e) => e.code === systemCode);
|
1321
|
+
return `${userId}:${systemLogin.sessionId}`;
|
1322
|
+
}
|
1323
|
+
async bypass2FA(systemCode, dbTransaction) {
|
1324
|
+
try {
|
1325
|
+
const user = await User._Repository.findOne({
|
1326
|
+
where: {
|
1327
|
+
UserId: this.UserId,
|
1328
|
+
},
|
1329
|
+
transaction: dbTransaction,
|
1330
|
+
});
|
1331
|
+
if (user.MFAEnabled === 1) {
|
1332
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Cannot bypass 2FA as it is enabled');
|
1333
|
+
}
|
1334
|
+
const userSession = await this._SessionService.retrieveUserSession(`${this.UserId}`);
|
1335
|
+
if (!systemCode) {
|
1336
|
+
systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1337
|
+
}
|
1338
|
+
const systemLogin = userSession.systemLogins.find((e) => e.code === systemCode);
|
1339
|
+
return `${this.UserId}:${systemLogin.sessionId}`;
|
1340
|
+
}
|
1341
|
+
catch (error) {
|
1342
|
+
throw error;
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
async addUserGroup(GroupCode, loginUser, dbTransaction) {
|
1346
|
+
const group = await User._GroupRepo.findOne({
|
1347
|
+
where: {
|
1348
|
+
GroupCode,
|
1349
|
+
},
|
1350
|
+
transaction: dbTransaction,
|
1351
|
+
});
|
1352
|
+
if (!group) {
|
1353
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Group Code');
|
1354
|
+
}
|
1355
|
+
const entityValueAfter = {
|
1356
|
+
UserId: this.UserId,
|
1357
|
+
GroupCode: group.GroupCode,
|
1358
|
+
CreatedAt: new Date(),
|
1359
|
+
CreatedById: loginUser.UserId,
|
1360
|
+
UpdatedAt: new Date(),
|
1361
|
+
UpdatedById: loginUser.UserId,
|
1362
|
+
};
|
1363
|
+
await User._UserGroupRepo.create(entityValueAfter, {
|
1364
|
+
transaction: dbTransaction,
|
1365
|
+
});
|
1366
|
+
const activity = new activity_history_1.Activity();
|
1367
|
+
activity.ActivityId = activity.createId();
|
1368
|
+
activity.Action = activity_history_1.ActionEnum.CREATE;
|
1369
|
+
activity.Description = 'Add User Group';
|
1370
|
+
activity.EntityType = 'UserGroup';
|
1371
|
+
activity.EntityId = group.GroupCode;
|
1372
|
+
activity.EntityValueBefore = JSON.stringify({});
|
1373
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
1374
|
+
await activity.create(loginUser.ObjectId, dbTransaction);
|
1375
|
+
}
|
1376
|
+
async update(data, loginUser, dbTransaction) {
|
1377
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1378
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'User - Update');
|
1379
|
+
if (!isPrivileged) {
|
1380
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'You do not have the privilege to update user');
|
1381
|
+
}
|
1382
|
+
if (!this.UserId) {
|
1383
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'UserId is required');
|
1384
|
+
}
|
1385
|
+
if (data.Email !== this.Email) {
|
1386
|
+
await User.checkUserInfoDuplicated(dbTransaction, {
|
1387
|
+
UserName: data.UserName,
|
1388
|
+
});
|
1389
|
+
}
|
1390
|
+
if (data.UserName !== this.UserName) {
|
1391
|
+
await User.checkUserInfoDuplicated(dbTransaction, {
|
1392
|
+
UserName: data.UserName,
|
1393
|
+
});
|
1394
|
+
}
|
1395
|
+
if (data.BuildingCode) {
|
1396
|
+
const building = await group_entity_1.default.findOne({
|
1397
|
+
where: {
|
1398
|
+
Type: 'Building',
|
1399
|
+
GroupCode: data.BuildingCode,
|
1400
|
+
},
|
1401
|
+
transaction: dbTransaction,
|
1402
|
+
});
|
1403
|
+
if (!building) {
|
1404
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Building Code');
|
1405
|
+
}
|
1406
|
+
const userBuilding = await User._UserGroupRepo.findOne({
|
1407
|
+
where: {
|
1408
|
+
UserId: this.UserId,
|
1409
|
+
},
|
1410
|
+
include: [
|
1411
|
+
{
|
1412
|
+
model: group_entity_1.default,
|
1413
|
+
where: {
|
1414
|
+
Type: 'Building',
|
1415
|
+
},
|
1416
|
+
},
|
1417
|
+
],
|
1418
|
+
transaction: dbTransaction,
|
1419
|
+
});
|
1420
|
+
if (userBuilding) {
|
1421
|
+
await User._UserGroupRepo.update({
|
1422
|
+
GroupCode: data.BuildingCode,
|
1423
|
+
UpdatedAt: new Date(),
|
1424
|
+
UpdatedById: loginUser.UserId,
|
1425
|
+
}, {
|
1426
|
+
where: {
|
1427
|
+
UserId: this.UserId,
|
1428
|
+
GroupCode: userBuilding.GroupCode,
|
1429
|
+
},
|
1430
|
+
transaction: dbTransaction,
|
1431
|
+
});
|
1432
|
+
}
|
1433
|
+
else {
|
1434
|
+
await User._UserGroupRepo.create({
|
1435
|
+
UserId: this.UserId,
|
1436
|
+
GroupCode: data.BuildingCode,
|
1437
|
+
CreatedAt: new Date(),
|
1438
|
+
CreatedById: loginUser.UserId,
|
1439
|
+
UpdatedAt: new Date(),
|
1440
|
+
UpdatedById: loginUser.UserId,
|
1441
|
+
}, {
|
1442
|
+
transaction: dbTransaction,
|
1443
|
+
});
|
1444
|
+
}
|
1445
|
+
}
|
1446
|
+
if (data.CompanyCode) {
|
1447
|
+
const company = await group_entity_1.default.findOne({
|
1448
|
+
where: {
|
1449
|
+
Type: 'Company',
|
1450
|
+
GroupCode: data.CompanyCode,
|
1451
|
+
},
|
1452
|
+
transaction: dbTransaction,
|
1453
|
+
});
|
1454
|
+
if (!company) {
|
1455
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Company Code');
|
1456
|
+
}
|
1457
|
+
const userCompany = await User._UserGroupRepo.findOne({
|
1458
|
+
where: {
|
1459
|
+
UserId: this.UserId,
|
1460
|
+
},
|
1461
|
+
include: [
|
1462
|
+
{
|
1463
|
+
model: group_entity_1.default,
|
1464
|
+
where: {
|
1465
|
+
Type: 'Company',
|
1466
|
+
},
|
1467
|
+
},
|
1468
|
+
],
|
1469
|
+
transaction: dbTransaction,
|
1470
|
+
});
|
1471
|
+
if (userCompany) {
|
1472
|
+
await User._UserGroupRepo.update({
|
1473
|
+
GroupCode: data.CompanyCode,
|
1474
|
+
UpdatedAt: new Date(),
|
1475
|
+
UpdatedById: loginUser.UserId,
|
1476
|
+
}, {
|
1477
|
+
where: {
|
1478
|
+
UserId: this.UserId,
|
1479
|
+
GroupCode: userCompany.GroupCode,
|
1480
|
+
},
|
1481
|
+
transaction: dbTransaction,
|
1482
|
+
});
|
1483
|
+
}
|
1484
|
+
else {
|
1485
|
+
await User._UserGroupRepo.create({
|
1486
|
+
UserId: this.UserId,
|
1487
|
+
GroupCode: data.CompanyCode,
|
1488
|
+
CreatedAt: new Date(),
|
1489
|
+
CreatedById: loginUser.UserId,
|
1490
|
+
UpdatedAt: new Date(),
|
1491
|
+
UpdatedById: loginUser.UserId,
|
1492
|
+
}, {
|
1493
|
+
transaction: dbTransaction,
|
1494
|
+
});
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
if (data.DepartmentCode) {
|
1498
|
+
const department = await group_entity_1.default.findOne({
|
1499
|
+
where: {
|
1500
|
+
Type: 'Department',
|
1501
|
+
GroupCode: data.DepartmentCode,
|
1502
|
+
},
|
1503
|
+
transaction: dbTransaction,
|
1504
|
+
});
|
1505
|
+
if (!department) {
|
1506
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'Invalid Department Code');
|
1507
|
+
}
|
1508
|
+
const userDepartment = await User._UserGroupRepo.findOne({
|
1509
|
+
where: {
|
1510
|
+
UserId: this.UserId,
|
1511
|
+
},
|
1512
|
+
include: [
|
1513
|
+
{
|
1514
|
+
model: group_entity_1.default,
|
1515
|
+
where: {
|
1516
|
+
Type: 'Department',
|
1517
|
+
},
|
1518
|
+
},
|
1519
|
+
],
|
1520
|
+
transaction: dbTransaction,
|
1521
|
+
});
|
1522
|
+
if (userDepartment) {
|
1523
|
+
await User._UserGroupRepo.update({
|
1524
|
+
GroupCode: data.DepartmentCode,
|
1525
|
+
UpdatedAt: new Date(),
|
1526
|
+
UpdatedById: loginUser.UserId,
|
1527
|
+
}, {
|
1528
|
+
where: {
|
1529
|
+
UserId: this.UserId,
|
1530
|
+
GroupCode: userDepartment.GroupCode,
|
1531
|
+
},
|
1532
|
+
transaction: dbTransaction,
|
1533
|
+
});
|
1534
|
+
}
|
1535
|
+
else {
|
1536
|
+
await User._UserGroupRepo.create({
|
1537
|
+
UserId: this.UserId,
|
1538
|
+
GroupCode: data.DepartmentCode,
|
1539
|
+
CreatedAt: new Date(),
|
1540
|
+
CreatedById: loginUser.UserId,
|
1541
|
+
UpdatedAt: new Date(),
|
1542
|
+
UpdatedById: loginUser.UserId,
|
1543
|
+
}, {
|
1544
|
+
transaction: dbTransaction,
|
1545
|
+
});
|
1546
|
+
}
|
1547
|
+
}
|
1548
|
+
const entityValueBefore = {
|
1549
|
+
UserId: this.UserId,
|
1550
|
+
UserName: this.UserName,
|
1551
|
+
Email: this.Email,
|
1552
|
+
Password: this.Password,
|
1553
|
+
Status: this.Status,
|
1554
|
+
DefaultPasswordChangedYN: this.DefaultPasswordChangedYN,
|
1555
|
+
FirstLoginAt: this.FirstLoginAt,
|
1556
|
+
LastLoginAt: this.LastLoginAt,
|
1557
|
+
MFAEnabled: this.MFAEnabled,
|
1558
|
+
MFAConfig: this.MFAConfig,
|
1559
|
+
RecoveryEmail: this.RecoveryEmail,
|
1560
|
+
FailedLoginAttemptCount: this.FailedLoginAttemptCount,
|
1561
|
+
LastFailedLoginAt: this.LastFailedLoginAt,
|
1562
|
+
LastPasswordChangedAt: this.LastPasswordChangedAt,
|
1563
|
+
NeedToChangePasswordYN: this.NeedToChangePasswordYN,
|
1564
|
+
CreatedById: this.CreatedById,
|
1565
|
+
CreatedAt: this.CreatedAt,
|
1566
|
+
UpdatedById: this.UpdatedById,
|
1567
|
+
UpdatedAt: this.UpdatedAt,
|
1568
|
+
};
|
1569
|
+
this.UserName = data.UserName;
|
1570
|
+
this.Email = data.Email;
|
1571
|
+
this.Status = data.Status;
|
1572
|
+
this.RecoveryEmail = data.RecoveryEmail;
|
1573
|
+
this.UpdatedAt = new Date();
|
1574
|
+
this.UpdatedById = loginUser.UserId;
|
1575
|
+
await User._Repository.update({
|
1576
|
+
UserName: this.UserName,
|
1577
|
+
Email: this.Email,
|
1578
|
+
Status: this.Status,
|
1579
|
+
RecoveryEmail: this.RecoveryEmail,
|
1580
|
+
UpdatedById: this.UpdatedById,
|
1581
|
+
UpdatedAt: this.UpdatedAt,
|
1582
|
+
}, {
|
1583
|
+
where: {
|
1584
|
+
UserId: this.UserId,
|
1585
|
+
},
|
1586
|
+
transaction: dbTransaction,
|
1587
|
+
});
|
1588
|
+
const entityValueAfter = {
|
1589
|
+
UserId: this.UserId,
|
1590
|
+
UserName: this.UserName,
|
1591
|
+
Email: this.Email,
|
1592
|
+
Password: this.Password,
|
1593
|
+
Status: this.Status,
|
1594
|
+
DefaultPasswordChangedYN: this.DefaultPasswordChangedYN,
|
1595
|
+
FirstLoginAt: this.FirstLoginAt,
|
1596
|
+
LastLoginAt: this.LastLoginAt,
|
1597
|
+
MFAEnabled: this.MFAEnabled,
|
1598
|
+
MFAConfig: this.MFAConfig,
|
1599
|
+
RecoveryEmail: this.RecoveryEmail,
|
1600
|
+
FailedLoginAttemptCount: this.FailedLoginAttemptCount,
|
1601
|
+
LastFailedLoginAt: this.LastFailedLoginAt,
|
1602
|
+
LastPasswordChangedAt: this.LastPasswordChangedAt,
|
1603
|
+
NeedToChangePasswordYN: this.NeedToChangePasswordYN,
|
1604
|
+
CreatedById: this.CreatedById,
|
1605
|
+
CreatedAt: this.CreatedAt,
|
1606
|
+
UpdatedById: this.UpdatedById,
|
1607
|
+
UpdatedAt: this.UpdatedAt,
|
1608
|
+
};
|
1609
|
+
const activity = new activity_history_1.Activity();
|
1610
|
+
activity.ActivityId = activity.createId();
|
1611
|
+
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
1612
|
+
activity.Description = 'Update User';
|
1613
|
+
activity.EntityType = 'LoginUser';
|
1614
|
+
activity.EntityId = this.UserId.toString();
|
1615
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
1616
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
1617
|
+
await activity.create(loginUser.ObjectId, dbTransaction);
|
1618
|
+
return this;
|
1619
|
+
}
|
1620
|
+
static async findById(loginUser, dbTransaction, UserId) {
|
1621
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1622
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'USER_VIEW');
|
1623
|
+
if (!isPrivileged) {
|
1624
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'You do not have the privilege to find user');
|
1625
|
+
}
|
1626
|
+
const user = await User._Repository.findOne({
|
1627
|
+
where: {
|
1628
|
+
UserId: UserId,
|
1629
|
+
Status: 'Active',
|
1630
|
+
},
|
1631
|
+
transaction: dbTransaction,
|
1632
|
+
});
|
1633
|
+
const userAttr = {
|
1634
|
+
UserId: user.UserId,
|
1635
|
+
UserName: user.UserName,
|
1636
|
+
FullName: user?.FullName || null,
|
1637
|
+
IDNo: user?.IdNo || null,
|
1638
|
+
IDType: user?.IdType || null,
|
1639
|
+
ContactNo: user?.ContactNo || null,
|
1640
|
+
Email: user.Email,
|
1641
|
+
Password: user.Password,
|
1642
|
+
Status: user.Status,
|
1643
|
+
DefaultPasswordChangedYN: user.DefaultPasswordChangedYN,
|
1644
|
+
FirstLoginAt: user.FirstLoginAt,
|
1645
|
+
LastLoginAt: user.LastLoginAt,
|
1646
|
+
MFAEnabled: user.MFAEnabled,
|
1647
|
+
MFAConfig: user.MFAConfig,
|
1648
|
+
RecoveryEmail: user.RecoveryEmail,
|
1649
|
+
FailedLoginAttemptCount: user.FailedLoginAttemptCount,
|
1650
|
+
LastFailedLoginAt: user.LastFailedLoginAt,
|
1651
|
+
LastPasswordChangedAt: user.LastPasswordChangedAt,
|
1652
|
+
NeedToChangePasswordYN: user.NeedToChangePasswordYN,
|
1653
|
+
CreatedById: user.CreatedById,
|
1654
|
+
CreatedAt: user.CreatedAt,
|
1655
|
+
UpdatedById: user.UpdatedById,
|
1656
|
+
UpdatedAt: user.UpdatedAt,
|
1657
|
+
staffs: user?.Staff || null,
|
1658
|
+
};
|
1659
|
+
return new User(null, dbTransaction, userAttr);
|
1660
|
+
}
|
1661
|
+
static async getFullName(dbTransaction, UserId) {
|
1662
|
+
try {
|
1663
|
+
const user = await User._Repository.findOne({
|
1664
|
+
where: {
|
1665
|
+
UserId: UserId,
|
1666
|
+
},
|
1667
|
+
transaction: dbTransaction,
|
1668
|
+
});
|
1669
|
+
if (!user) {
|
1670
|
+
throw new general_1.ClassError('User', 'UserErrMsg0X', 'No user found.');
|
1671
|
+
}
|
1672
|
+
if (user?.FullName) {
|
1673
|
+
return user?.FullName;
|
1674
|
+
}
|
1675
|
+
else if (user?.UserName) {
|
1676
|
+
return user?.UserName;
|
1677
|
+
}
|
1678
|
+
else {
|
1679
|
+
return '';
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
catch (error) {
|
1683
|
+
throw error;
|
1684
|
+
}
|
1685
|
+
}
|
1686
|
+
static async findByEmail(loginUser, dbTransaction, Email) {
|
1687
|
+
try {
|
1688
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
1689
|
+
const isPrivileged = await loginUser.checkPrivileges(systemCode, 'USER_VIEW');
|
1690
|
+
if (!isPrivileged) {
|
1691
|
+
throw new general_1.ClassError('LoginUser', 'LoginUserErrMsg0X', 'You do not have the privilege to find user');
|
1692
|
+
}
|
1693
|
+
const user = await User._Repository.findOne({
|
1694
|
+
where: {
|
1695
|
+
Email: Email,
|
1696
|
+
},
|
1697
|
+
include: [
|
1698
|
+
{
|
1699
|
+
model: staff_entity_1.default,
|
1700
|
+
},
|
1701
|
+
],
|
1702
|
+
transaction: dbTransaction,
|
1703
|
+
});
|
1704
|
+
if (!user) {
|
1705
|
+
throw new general_1.ClassError('User', 'UserErrMsg0X', 'User not found.');
|
1706
|
+
}
|
1707
|
+
const userAttr = {
|
1708
|
+
UserId: user.UserId,
|
1709
|
+
UserName: user.UserName,
|
1710
|
+
FullName: user?.FullName || null,
|
1711
|
+
IDNo: user?.IdNo || null,
|
1712
|
+
IDType: user?.IdType || null,
|
1713
|
+
ContactNo: user?.ContactNo || null,
|
1714
|
+
Email: user.Email,
|
1715
|
+
Password: user.Password,
|
1716
|
+
Status: user.Status,
|
1717
|
+
DefaultPasswordChangedYN: user.DefaultPasswordChangedYN,
|
1718
|
+
FirstLoginAt: user.FirstLoginAt,
|
1719
|
+
LastLoginAt: user.LastLoginAt,
|
1720
|
+
MFAEnabled: user.MFAEnabled,
|
1721
|
+
MFAConfig: user.MFAConfig,
|
1722
|
+
RecoveryEmail: user.RecoveryEmail,
|
1723
|
+
FailedLoginAttemptCount: user.FailedLoginAttemptCount,
|
1724
|
+
LastFailedLoginAt: user.LastFailedLoginAt,
|
1725
|
+
LastPasswordChangedAt: user.LastPasswordChangedAt,
|
1726
|
+
NeedToChangePasswordYN: user.NeedToChangePasswordYN,
|
1727
|
+
CreatedById: user.CreatedById,
|
1728
|
+
CreatedAt: user.CreatedAt,
|
1729
|
+
UpdatedById: user.UpdatedById,
|
1730
|
+
UpdatedAt: user.UpdatedAt,
|
1731
|
+
staffs: user?.Staff,
|
1732
|
+
};
|
1733
|
+
const sessionService = await session_service_1.SessionService.init(undefined);
|
1734
|
+
const usr = new User(sessionService, undefined, userAttr);
|
1735
|
+
return usr;
|
1736
|
+
}
|
1737
|
+
catch (error) {
|
1738
|
+
throw error;
|
1739
|
+
}
|
1740
|
+
}
|
1741
|
+
}
|
1742
|
+
exports.User = User;
|
1743
|
+
User._Repository = new user_repository_1.UserRepository();
|
1744
|
+
User._LoginHistoryRepository = new login_history_repository_1.LoginHistoryRepository();
|
1745
|
+
User._UserGroupRepo = new user_group_repository_1.UserGroupRepository();
|
1746
|
+
User._UserPrivilegeRepo = new user_privilege_repository_1.UserPrivilegeRepository();
|
1747
|
+
User._UserObjectPrivilegeRepo = new user_object_privilege_repository_1.UserObjectPrivilegeRepository();
|
1748
|
+
User._GroupObjectPrivilegeRepo = new group_object_privilege_repository_1.GroupObjectPrivilegeRepository();
|
1749
|
+
User._SystemRepository = new system_repository_1.SystemRepository();
|
1750
|
+
User._UserSystemAccessRepo = new user_system_access_repository_1.UserSystemAccessRepository();
|
1751
|
+
User._GroupSystemAccessRepo = new group_system_access_repository_1.GroupSystemAccessRepository();
|
1752
|
+
User._GroupRepo = new group_repository_1.GroupRepository();
|
1753
|
+
//# sourceMappingURL=user.js.map
|