@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.
Files changed (2) hide show
  1. package/lib/user/index.js +11 -6
  2. 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
- req.user = new ApiUser_1.default(userId);
24
+ const userObject = new ApiUser_1.default(userId);
25
25
  if (options.eagerLoadUserPermissions) {
26
- yield req.user.getUserPermissions();
26
+ yield userObject.getUserPermissions();
27
27
  }
28
28
  if (options.eagerLoadUserPermissionsLegacy) {
29
- yield req.user.getUserPermissionsLegacy();
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 req.user.getUserPermissions();
46
+ yield userObject.getUserPermissions();
45
47
  }
46
48
  if (options.eagerLoadUserPermissionsLegacy) {
47
- yield req.user.getUserPermissionsLegacy();
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/zehut",
3
- "version": "1.2.10",
3
+ "version": "1.2.13",
4
4
  "description": "manage user's identity",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",