rez_core 2.1.133 → 2.1.136
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/module/listmaster/entity/list-master-items.entity.js +5 -5
- package/dist/module/listmaster/entity/list-master-items.entity.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.d.ts +1 -1
- package/dist/module/module/controller/module-access.controller.js +6 -6
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +2 -1
- package/dist/module/module/service/module-access.service.js +5 -3
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/listmaster/entity/list-master-items.entity.ts +5 -5
- package/src/module/module/controller/module-access.controller.ts +9 -4
- package/src/module/module/service/module-access.service.ts +15 -8
package/package.json
CHANGED
|
@@ -12,19 +12,19 @@ export class ListMasterItems extends BaseEntity {
|
|
|
12
12
|
@PrimaryGeneratedColumn()
|
|
13
13
|
id: number;
|
|
14
14
|
|
|
15
|
-
@Column()
|
|
15
|
+
@Column({ nullable: true })
|
|
16
16
|
listtype: string;
|
|
17
17
|
|
|
18
|
-
@Column()
|
|
18
|
+
@Column({ nullable: true })
|
|
19
19
|
name: string;
|
|
20
20
|
|
|
21
|
-
@Column()
|
|
21
|
+
@Column({ nullable: true })
|
|
22
22
|
parent_code: string;
|
|
23
23
|
|
|
24
|
-
@Column()
|
|
24
|
+
@Column({ nullable: true })
|
|
25
25
|
value: string;
|
|
26
26
|
|
|
27
|
-
@Column()
|
|
27
|
+
@Column({ nullable: true })
|
|
28
28
|
status: string;
|
|
29
29
|
|
|
30
30
|
@Column({ default: 0 })
|
|
@@ -23,16 +23,21 @@ export class ModuleAccessController {
|
|
|
23
23
|
private readonly menuService: MenuService,
|
|
24
24
|
) {}
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
@Get('roles')
|
|
27
|
-
async getRoles(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
async getRoles(
|
|
29
|
+
@Query('appcode') appcode: string,
|
|
30
|
+
@Query('include') include: string, // ✅ declare it as boolean
|
|
31
|
+
@Request() req
|
|
32
|
+
) {
|
|
33
|
+
const { level_type, level_id, organization_id } = req.user.userData;
|
|
34
|
+
|
|
31
35
|
return this.moduleAccessService.getRoles({
|
|
32
36
|
appcode,
|
|
33
37
|
level_type,
|
|
34
38
|
level_id,
|
|
35
39
|
organization_id,
|
|
40
|
+
include: include === "true", // ensure it's either true or false
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -33,42 +33,49 @@ export class ModuleAccessService {
|
|
|
33
33
|
level_type,
|
|
34
34
|
level_id,
|
|
35
35
|
organization_id,
|
|
36
|
+
include
|
|
36
37
|
}: {
|
|
37
38
|
appcode: string;
|
|
38
39
|
level_type?: string;
|
|
39
40
|
level_id?: number;
|
|
40
41
|
organization_id?: number;
|
|
42
|
+
include?: boolean;
|
|
41
43
|
}) {
|
|
42
44
|
const query = this.dataSource
|
|
43
45
|
.createQueryBuilder()
|
|
44
46
|
.select('*')
|
|
45
47
|
.from('cr_role', 'role')
|
|
46
|
-
.where('role.appcode = :appcode', { appcode })
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
.where('role.appcode = :appcode', { appcode });
|
|
49
|
+
|
|
50
|
+
// Only add this condition if `include` is false (exclude factory roles)
|
|
51
|
+
if (!include) {
|
|
52
|
+
query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
if (level_type) {
|
|
50
56
|
query.andWhere('role.level_type = :level_type', { level_type });
|
|
51
57
|
}
|
|
52
|
-
|
|
58
|
+
|
|
53
59
|
if (organization_id) {
|
|
54
60
|
query.andWhere('role.organization_id = :organization_id', {
|
|
55
61
|
organization_id,
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
|
-
|
|
64
|
+
|
|
59
65
|
if (level_id !== undefined) {
|
|
60
66
|
query.andWhere('role.level_id = :level_id', {
|
|
61
67
|
level_id: String(level_id),
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
const roles = await query.getRawMany();
|
|
66
|
-
|
|
70
|
+
|
|
71
|
+
const roles = await query.getRawMany();
|
|
72
|
+
|
|
67
73
|
return roles.map((role) => ({
|
|
68
74
|
label: role.name,
|
|
69
75
|
value: role.id,
|
|
70
76
|
}));
|
|
71
77
|
}
|
|
78
|
+
|
|
72
79
|
|
|
73
80
|
async getAccessListing(
|
|
74
81
|
roleIds: number[],
|