@autofleet/zehut 1.2.10 → 1.2.13
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/lib/user/index.js +11 -6
- package/package.json +1 -1
package/lib/user/index.js
CHANGED
|
@@ -21,13 +21,16 @@ exports.middleware = (options = {}) => (req, res, next) => __awaiter(void 0, voi
|
|
|
21
21
|
next();
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
const userObject = new ApiUser_1.default(userId);
|
|
25
25
|
if (options.eagerLoadUserPermissions) {
|
|
26
|
-
yield
|
|
26
|
+
yield userObject.getUserPermissions();
|
|
27
27
|
}
|
|
28
28
|
if (options.eagerLoadUserPermissionsLegacy) {
|
|
29
|
-
yield
|
|
29
|
+
yield userObject.getUserPermissionsLegacy();
|
|
30
30
|
}
|
|
31
|
+
req.user = userObject;
|
|
32
|
+
// Added in order to support outbreak.
|
|
33
|
+
req.headers['x-af-user-permissions'] = userObject;
|
|
31
34
|
next();
|
|
32
35
|
});
|
|
33
36
|
exports.middlewareWithDecode = (options = {}) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -39,13 +42,15 @@ exports.middlewareWithDecode = (options = {}) => (req, res, next) => __awaiter(v
|
|
|
39
42
|
req.headers['X-AF-USER-ID'] = userId;
|
|
40
43
|
}
|
|
41
44
|
const userObject = new ApiUser_1.default(userId);
|
|
42
|
-
req.user = userObject;
|
|
43
45
|
if (options.eagerLoadUserPermissions) {
|
|
44
|
-
yield
|
|
46
|
+
yield userObject.getUserPermissions();
|
|
45
47
|
}
|
|
46
48
|
if (options.eagerLoadUserPermissionsLegacy) {
|
|
47
|
-
yield
|
|
49
|
+
yield userObject.getUserPermissionsLegacy();
|
|
48
50
|
}
|
|
51
|
+
req.user = userObject;
|
|
52
|
+
// Added in order to support outbreak.
|
|
53
|
+
req.headers['x-af-user-permissions'] = userObject;
|
|
49
54
|
const entities = req.user.permissions;
|
|
50
55
|
}
|
|
51
56
|
next();
|