rez_core 2.1.60 → 2.1.61
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/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { ModuleAccess } from '../entity/module-access.entity';
|
|
|
5
5
|
import { UserRoleMapping } from 'src/module/user/entity/user-role-mapping.entity';
|
|
6
6
|
import { Role } from 'src/module/user/entity/role.entity';
|
|
7
7
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
8
|
+
import { get } from 'http';
|
|
8
9
|
|
|
9
10
|
@Injectable()
|
|
10
11
|
export class MenuRepository extends Repository<MenuData> {
|
|
@@ -95,6 +96,23 @@ export class MenuRepository extends Repository<MenuData> {
|
|
|
95
96
|
): Promise<number[]> {
|
|
96
97
|
const repo = this.dataSource.getRepository(UserRoleMapping);
|
|
97
98
|
|
|
99
|
+
if (userId) {
|
|
100
|
+
// Check if user has any role mappings for the given appcode
|
|
101
|
+
const getUserDetails = await this.dataSource.query(
|
|
102
|
+
`
|
|
103
|
+
SELECT * from cr_user where id = ?
|
|
104
|
+
`,
|
|
105
|
+
[userId],
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (
|
|
109
|
+
getUserDetails.length > 0 &&
|
|
110
|
+
getUserDetails[0].organization_id === 1
|
|
111
|
+
) {
|
|
112
|
+
return [6];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
98
116
|
// 1. Try exact level match
|
|
99
117
|
let roles = await repo
|
|
100
118
|
.createQueryBuilder('urm')
|