@tomei/sso 0.58.4 → 0.58.7
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -2501,31 +2501,20 @@ export class User extends UserBase {
|
|
2501
2501
|
AuthContext: AuthContext,
|
2502
2502
|
dbTransaction: any,
|
2503
2503
|
UserId: string,
|
2504
|
+
needActive: boolean = true,
|
2504
2505
|
) {
|
2505
|
-
// const systemCode = ApplicationConfig.getComponentConfigValue('system-code');
|
2506
|
-
// if ('loginUser' in AuthContext) {
|
2507
|
-
// const isPrivileged = await AuthContext.loginUser.checkPrivileges(
|
2508
|
-
// systemCode,
|
2509
|
-
// 'USER_VIEW',
|
2510
|
-
// );
|
2511
|
-
|
2512
|
-
// //If user does not have privilege to update user, throw a ClassError
|
2513
|
-
// if (!isPrivileged) {
|
2514
|
-
// throw new ClassError(
|
2515
|
-
// 'LoginUser',
|
2516
|
-
// 'LoginUserErrMsg0X',
|
2517
|
-
// 'You do not have the privilege to find user',
|
2518
|
-
// );
|
2519
|
-
// }
|
2520
|
-
// }
|
2521
|
-
|
2522
2506
|
const user = await User._Repository.findOne({
|
2523
2507
|
where: {
|
2524
2508
|
UserId: UserId,
|
2525
|
-
Status:
|
2509
|
+
Status: needActive ? UserStatus.ACTIVE : { [Op.not]: null },
|
2526
2510
|
},
|
2527
2511
|
transaction: dbTransaction,
|
2528
2512
|
});
|
2513
|
+
|
2514
|
+
if (!user) {
|
2515
|
+
throw new ClassError('User', 'UserErrMsg0X', 'No user found.');
|
2516
|
+
}
|
2517
|
+
|
2529
2518
|
const userAttr: IUserAttr = {
|
2530
2519
|
UserId: user.UserId,
|
2531
2520
|
UserName: user.UserName,
|