@nest-omni/core 1.0.34 → 1.0.35
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.
|
@@ -8,12 +8,12 @@ exports.User = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
|
8
8
|
});
|
|
9
9
|
function getUserData(req, data) {
|
|
10
10
|
const headers = req.headers;
|
|
11
|
-
if (lodash.isEmpty(headers['x-
|
|
11
|
+
if (lodash.isEmpty(headers['x-user-id']) ||
|
|
12
12
|
lodash.isEmpty(headers['x-username'])) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
const user = {
|
|
16
|
-
uid: headers['x-
|
|
16
|
+
uid: headers['x-user-id'],
|
|
17
17
|
username: headers['x-username'],
|
|
18
18
|
};
|
|
19
19
|
return data ? user[data] : user;
|
|
@@ -13,8 +13,8 @@ function getOmniAuthData(request, key) {
|
|
|
13
13
|
const headers = request.headers;
|
|
14
14
|
let user;
|
|
15
15
|
const configService = new config_1.ConfigService(request);
|
|
16
|
-
if ((0, lodash_1.isEmpty)(headers['x-
|
|
17
|
-
if (process.env.NODE_ENV === 'dev'
|
|
16
|
+
if ((0, lodash_1.isEmpty)(headers['x-user-id']) || (0, lodash_1.isEmpty)(headers['x-username'])) {
|
|
17
|
+
if (process.env.NODE_ENV === 'dev') {
|
|
18
18
|
user = {
|
|
19
19
|
uid: configService.get('MOCK_UID'),
|
|
20
20
|
username: configService.get('MOCK_USERNAME'),
|
|
@@ -27,10 +27,10 @@ function getOmniAuthData(request, key) {
|
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
user = {
|
|
30
|
-
uid: headers['x-
|
|
30
|
+
uid: headers['x-user-id'] || '',
|
|
31
31
|
username: headers['x-username'] || '',
|
|
32
|
-
appId: headers['x-
|
|
33
|
-
tenantId: headers['x-
|
|
32
|
+
appId: headers['x-app-id'] || '',
|
|
33
|
+
tenantId: headers['x-tenant-id'] || '',
|
|
34
34
|
admin: headers['x-admin'] === '1',
|
|
35
35
|
role: headers['x-role'] || '',
|
|
36
36
|
};
|