@punks/backend-entity-manager 0.0.109 → 0.0.110

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
@@ -2442,14 +2442,15 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
2442
2442
  });
2443
2443
  return isAuthenticated;
2444
2444
  }
2445
- this.logger.debug(`Authorized:false -> auth guard`, {
2445
+ const isAuthenticated = !!auth?.user;
2446
+ this.logger.debug(`Authorized:${isAuthenticated} -> auth guard`, {
2446
2447
  ...this.getContextInfo({
2447
2448
  context,
2448
2449
  roles: auth?.roles,
2449
2450
  user: auth?.user,
2450
2451
  }),
2451
2452
  });
2452
- return false;
2453
+ return isAuthenticated;
2453
2454
  }
2454
2455
  isRoleMatching(allowedRoles, userRoles) {
2455
2456
  return userRoles.some((role) => allowedRoles.includes(role.uid));
@@ -2486,14 +2487,16 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
2486
2487
  },
2487
2488
  ...(user
2488
2489
  ? {
2489
- id: user.id,
2490
- userName: user.userName,
2491
- email: user.email,
2492
- roles: roles?.map((role) => ({
2493
- id: role.id,
2494
- name: role.name,
2495
- uid: role.uid,
2496
- })),
2490
+ user: {
2491
+ id: user.id,
2492
+ userName: user.userName,
2493
+ email: user.email,
2494
+ roles: roles?.map((role) => ({
2495
+ id: role.id,
2496
+ name: role.name,
2497
+ uid: role.uid,
2498
+ })),
2499
+ },
2497
2500
  }
2498
2501
  : {}),
2499
2502
  };