@punks/backend-entity-manager 0.0.178 → 0.0.179

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/cjs/index.js CHANGED
@@ -2506,10 +2506,13 @@ const CurrentUser = common.createParamDecorator((data, context) => {
2506
2506
  const user = request.auth.user;
2507
2507
  const roles = request.auth.roles;
2508
2508
  const permissions = request.auth.permissions;
2509
+ const organizationalUnits = request.auth
2510
+ .organizationalUnits;
2509
2511
  return {
2510
2512
  user,
2511
2513
  roles,
2512
2514
  permissions,
2515
+ organizationalUnits,
2513
2516
  };
2514
2517
  });
2515
2518
 
@@ -22022,10 +22025,14 @@ let AuthenticationMiddleware = class AuthenticationMiddleware {
22022
22025
  const user = await this.getUserFromToken(parsedToken.data);
22023
22026
  const roles = user ? await this.getUserRoles(user) : [];
22024
22027
  const permissions = user ? await this.getUserPermissions(user) : [];
22028
+ const organizationalUnits = user
22029
+ ? await this.getUserOrganizationalUnits(user)
22030
+ : [];
22025
22031
  req.auth = {
22026
22032
  user,
22027
22033
  roles,
22028
22034
  permissions,
22035
+ organizationalUnits,
22029
22036
  };
22030
22037
  }
22031
22038
  }
@@ -22040,6 +22047,9 @@ let AuthenticationMiddleware = class AuthenticationMiddleware {
22040
22047
  async getUserPermissions(user) {
22041
22048
  return await this.authService.userRolesService.getUserPermissions(user.id);
22042
22049
  }
22050
+ async getUserOrganizationalUnits(user) {
22051
+ return await this.authService.userRolesService.getUserOrganizationalUnits(user.id);
22052
+ }
22043
22053
  extractTokenFromHeader(request) {
22044
22054
  const [type, token] = request.headers.authorization?.split(" ") ?? [];
22045
22055
  return type === "Bearer" ? token : undefined;