@tomei/sso 0.15.3 → 0.15.5
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/__tests__/unit/components/login-user/login-user.spec.ts +16 -16
- package/migrations/20240314080603-create-user-table.js +108 -0
- package/migrations/{04-create-user-user-group-table.js → 20240314080604-create-user-user-group-table.js} +1 -1
- package/migrations/{05-create-login-history-table.js → 20240314080605-create-login-history-table.js} +1 -1
- package/package.json +2 -1
- package/src/components/login-user/interfaces/user-info.interface.ts +29 -9
- package/src/components/login-user/login-user.ts +749 -557
- package/src/enum/index.ts +1 -0
- package/src/enum/yn.enum.ts +4 -0
- package/src/models/user.entity.ts +160 -110
@@ -0,0 +1 @@
|
|
1
|
+
export * from './yn.enum';
|
@@ -1,110 +1,160 @@
|
|
1
|
-
import {
|
2
|
-
BelongsTo,
|
3
|
-
BelongsToMany,
|
4
|
-
Column,
|
5
|
-
CreatedAt,
|
6
|
-
DataType,
|
7
|
-
ForeignKey,
|
8
|
-
HasMany,
|
9
|
-
HasOne,
|
10
|
-
Model,
|
11
|
-
Table,
|
12
|
-
UpdatedAt,
|
13
|
-
} from 'sequelize-typescript';
|
14
|
-
import UserGroup from './user-group.entity';
|
15
|
-
import Staff from './staff.entity';
|
16
|
-
import BearerToken from './bearer-token.entity';
|
17
|
-
import OAuthToken from './oauth-token.entity';
|
18
|
-
import UserRole from './user-role.entity';
|
19
|
-
import System from './system.entity';
|
20
|
-
import SystemAccess from './system-accesss.entity';
|
21
|
-
import Role from './role.entity';
|
22
|
-
import SystemRole from './system-role.entity';
|
23
|
-
import UserSystemRole from './user-system-role.entity';
|
24
|
-
import SystemPrivilege from './system-privilege.entity';
|
25
|
-
import UserSystemPrivileges from './user-system-privileges.entity';
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
@Column({
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
@
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
@
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
1
|
+
import {
|
2
|
+
BelongsTo,
|
3
|
+
BelongsToMany,
|
4
|
+
Column,
|
5
|
+
CreatedAt,
|
6
|
+
DataType,
|
7
|
+
ForeignKey,
|
8
|
+
HasMany,
|
9
|
+
HasOne,
|
10
|
+
Model,
|
11
|
+
Table,
|
12
|
+
UpdatedAt,
|
13
|
+
} from 'sequelize-typescript';
|
14
|
+
import UserGroup from './user-group.entity';
|
15
|
+
import Staff from './staff.entity';
|
16
|
+
import BearerToken from './bearer-token.entity';
|
17
|
+
import OAuthToken from './oauth-token.entity';
|
18
|
+
import UserRole from './user-role.entity';
|
19
|
+
import System from './system.entity';
|
20
|
+
import SystemAccess from './system-accesss.entity';
|
21
|
+
import Role from './role.entity';
|
22
|
+
import SystemRole from './system-role.entity';
|
23
|
+
import UserSystemRole from './user-system-role.entity';
|
24
|
+
import SystemPrivilege from './system-privilege.entity';
|
25
|
+
import UserSystemPrivileges from './user-system-privileges.entity';
|
26
|
+
import { YN } from '../enum/yn.enum';
|
27
|
+
|
28
|
+
@Table({
|
29
|
+
tableName: 'sso_User',
|
30
|
+
timestamps: true,
|
31
|
+
createdAt: 'CreatedAt',
|
32
|
+
updatedAt: 'UpdatedAt',
|
33
|
+
})
|
34
|
+
export default class User extends Model {
|
35
|
+
@Column({
|
36
|
+
primaryKey: true,
|
37
|
+
allowNull: false,
|
38
|
+
type: DataType.INTEGER,
|
39
|
+
})
|
40
|
+
UserId: number;
|
41
|
+
|
42
|
+
@Column({
|
43
|
+
allowNull: false,
|
44
|
+
type: DataType.STRING,
|
45
|
+
})
|
46
|
+
Email: string;
|
47
|
+
|
48
|
+
@Column({
|
49
|
+
allowNull: false,
|
50
|
+
type: DataType.STRING,
|
51
|
+
})
|
52
|
+
Password: string;
|
53
|
+
|
54
|
+
@Column({
|
55
|
+
allowNull: false,
|
56
|
+
type: DataType.STRING,
|
57
|
+
})
|
58
|
+
Status: string;
|
59
|
+
|
60
|
+
@Column({
|
61
|
+
allowNull: false,
|
62
|
+
type: DataType.CHAR(1),
|
63
|
+
})
|
64
|
+
DefaultPasswordChangedYN: YN;
|
65
|
+
|
66
|
+
@Column({
|
67
|
+
type: DataType.DATE,
|
68
|
+
})
|
69
|
+
FirstLoginAt: Date;
|
70
|
+
|
71
|
+
@Column({
|
72
|
+
type: DataType.DATE,
|
73
|
+
})
|
74
|
+
LastLoginAt: Date;
|
75
|
+
|
76
|
+
@Column({
|
77
|
+
type: DataType.TINYINT,
|
78
|
+
})
|
79
|
+
MFAEnabled: number;
|
80
|
+
|
81
|
+
@Column({
|
82
|
+
type: DataType.TEXT,
|
83
|
+
})
|
84
|
+
MFAConfig: string;
|
85
|
+
|
86
|
+
@Column({
|
87
|
+
type: DataType.STRING,
|
88
|
+
})
|
89
|
+
RecoveryEmail: string;
|
90
|
+
|
91
|
+
@Column({
|
92
|
+
allowNull: false,
|
93
|
+
type: DataType.INTEGER,
|
94
|
+
})
|
95
|
+
FailedLoginAttemptCount: number;
|
96
|
+
|
97
|
+
@Column({
|
98
|
+
type: DataType.DATE,
|
99
|
+
})
|
100
|
+
LastFailedLoginAt: Date;
|
101
|
+
|
102
|
+
@Column({
|
103
|
+
type: DataType.DATE,
|
104
|
+
})
|
105
|
+
LastPasswordChangedAt: Date;
|
106
|
+
|
107
|
+
@Column({
|
108
|
+
allowNull: false,
|
109
|
+
type: DataType.CHAR(1),
|
110
|
+
})
|
111
|
+
NeedToChangePasswordYN: YN;
|
112
|
+
|
113
|
+
@ForeignKey(() => User)
|
114
|
+
@Column({
|
115
|
+
type: DataType.INTEGER,
|
116
|
+
})
|
117
|
+
CreatedById: number;
|
118
|
+
|
119
|
+
@CreatedAt
|
120
|
+
CreatedAt: Date;
|
121
|
+
|
122
|
+
@ForeignKey(() => User)
|
123
|
+
@Column({
|
124
|
+
type: DataType.INTEGER,
|
125
|
+
})
|
126
|
+
UpdatedById: number;
|
127
|
+
|
128
|
+
@UpdatedAt
|
129
|
+
UpdatedAt: Date;
|
130
|
+
|
131
|
+
@HasOne(() => Staff)
|
132
|
+
Staff: Staff;
|
133
|
+
|
134
|
+
@HasMany(() => BearerToken)
|
135
|
+
BearerTokens: BearerToken[];
|
136
|
+
|
137
|
+
@HasMany(() => OAuthToken)
|
138
|
+
OAuthTokens: OAuthToken[];
|
139
|
+
|
140
|
+
@HasMany(() => UserRole)
|
141
|
+
UserRoles: UserRole[];
|
142
|
+
|
143
|
+
@BelongsToMany(() => System, () => SystemAccess)
|
144
|
+
Systems: System[];
|
145
|
+
|
146
|
+
@BelongsToMany(() => Role, () => UserRole)
|
147
|
+
Roles: Role[];
|
148
|
+
|
149
|
+
@BelongsToMany(() => SystemRole, () => UserSystemRole)
|
150
|
+
SystemRoles: SystemRole[];
|
151
|
+
|
152
|
+
@BelongsToMany(() => SystemPrivilege, () => UserSystemPrivileges)
|
153
|
+
SystemPrivileges: SystemPrivilege[];
|
154
|
+
|
155
|
+
@BelongsTo(() => User, 'CreatedById')
|
156
|
+
CreatedBy: User;
|
157
|
+
|
158
|
+
@BelongsTo(() => User, 'UpdatedById')
|
159
|
+
UpdatedBy: User;
|
160
|
+
}
|