ecrs-auth-core 1.0.93 → 1.0.95
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/dist/auth.controller.js
CHANGED
|
@@ -48,19 +48,19 @@ let AuthController = class AuthController {
|
|
|
48
48
|
else {
|
|
49
49
|
console.log(`✅ User ${body.email} authenticated successfully`);
|
|
50
50
|
}
|
|
51
|
-
console.log('📊 User details:', user);
|
|
51
|
+
// console.log('📊 User details:', user);
|
|
52
52
|
const requestedModuleId = Number(body.moduleId);
|
|
53
53
|
console.log(`📍 User ${body.email} requested access to module ID: ${requestedModuleId}`);
|
|
54
54
|
if (!Number.isFinite(requestedModuleId)) {
|
|
55
55
|
console.warn(`⚠️ Invalid module ID provided by user ${body.email}: ${body.moduleId}`);
|
|
56
56
|
throw new common_1.UnauthorizedException('You are not authorized to access this module');
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
console.log(`🔍 Checking module access for user ID ${user.id} and module ID ${requestedModuleId}...`);
|
|
59
|
+
const allowedDb = await this.authService.hasModuleAccess(user.id, requestedModuleId);
|
|
60
|
+
console.log(`📊 Module access check result for user ID ${user.id} and module ID ${requestedModuleId}: ${allowedDb ? 'Allowed' : 'Denied'}`);
|
|
61
|
+
if (!allowedDb) {
|
|
62
|
+
throw new common_1.UnauthorizedException('You are not authorized to access this module');
|
|
63
|
+
}
|
|
64
64
|
// const perms = await this.authService.getPermissions(user.id);
|
|
65
65
|
// console.log(`📊 User permissions for ${body.email}:`, perms);
|
|
66
66
|
// if (!Array.isArray(perms.modules) || !perms.modules.includes(requestedModuleId)) {
|
package/dist/auth.service.js
CHANGED
|
@@ -59,7 +59,7 @@ let AuthService = class AuthService {
|
|
|
59
59
|
this.userRepo = repositories.userRepo;
|
|
60
60
|
this.roleRepo = repositories.roleRepo;
|
|
61
61
|
this.moduleRepo = repositories.moduleRepo;
|
|
62
|
-
this.featureRepo = repositories.featureRepo;
|
|
62
|
+
// this.featureRepo = repositories.featureRepo;
|
|
63
63
|
this.routeRepo = repositories.routeRepo;
|
|
64
64
|
// this.featureAccessRepo = repositories.featureAccessRepo;
|
|
65
65
|
this.moduleAccessRepo = repositories.moduleAccessRepo;
|
|
@@ -2,7 +2,6 @@ import { Repository } from 'typeorm';
|
|
|
2
2
|
import { User } from '../entities/user.entity';
|
|
3
3
|
import { Role } from '../entities/role.entity';
|
|
4
4
|
import { Module } from '../entities/module.entity';
|
|
5
|
-
import { Feature } from '../entities/feature.entity';
|
|
6
5
|
import { ModuleRoute } from '../entities/module-route.entity';
|
|
7
6
|
import { UserModuleAccess } from '../entities/user-module-access.entity';
|
|
8
7
|
import { ModuleScreenPermission } from '../entities/module-screen-permission.entity';
|
|
@@ -16,14 +15,13 @@ export interface Repositories {
|
|
|
16
15
|
roleRepo: Repository<Role>;
|
|
17
16
|
moduleRepo: Repository<Module>;
|
|
18
17
|
screenPermissionRepo: Repository<ModuleScreenPermission>;
|
|
19
|
-
featureRepo: Repository<Feature>;
|
|
20
18
|
routeRepo: Repository<ModuleRoute>;
|
|
21
19
|
moduleAccessRepo: Repository<UserModuleAccess>;
|
|
22
|
-
apiKeyRepo
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
loginDetailsRepo
|
|
26
|
-
|
|
20
|
+
apiKeyRepo: Repository<ApiKeyEntity>;
|
|
21
|
+
employeeWorkProfileRepo: Repository<EmployeeWorkProfileEntity>;
|
|
22
|
+
ipRestrictionsRepo: Repository<EmployeeIPAccessEntity>;
|
|
23
|
+
loginDetailsRepo: Repository<LoginDetailsEntity>;
|
|
24
|
+
userLastLoginRepo: Repository<UserLastLoginEntity>;
|
|
27
25
|
}
|
|
28
26
|
export interface AuthModuleConfig {
|
|
29
27
|
enable2FA?: boolean;
|