@abp/ng.core 10.0.2 → 10.0.3

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.
@@ -5075,6 +5075,7 @@ class PermissionGuard {
5075
5075
  this.authService = inject(AuthService);
5076
5076
  this.permissionService = inject(PermissionService);
5077
5077
  this.httpErrorReporter = inject(HttpErrorReporterService);
5078
+ this.configStateService = inject(ConfigStateService);
5078
5079
  }
5079
5080
  canActivate(route, state) {
5080
5081
  let { requiredPolicy } = route.data || {};
@@ -5085,7 +5086,7 @@ class PermissionGuard {
5085
5086
  if (!requiredPolicy) {
5086
5087
  return of(true);
5087
5088
  }
5088
- return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe(take(1), map(access => {
5089
+ return this.configStateService.getAll$().pipe(filter(config => !!config?.auth?.grantedPolicies), take(1), switchMap(() => this.permissionService.getGrantedPolicy$(requiredPolicy)), take(1), map(access => {
5089
5090
  if (access)
5090
5091
  return true;
5091
5092
  if (route.data?.['redirectUrl']) {
@@ -5112,6 +5113,7 @@ const permissionGuard = (route, state) => {
5112
5113
  const authService = inject(AuthService);
5113
5114
  const permissionService = inject(PermissionService);
5114
5115
  const httpErrorReporter = inject(HttpErrorReporterService);
5116
+ const configStateService = inject(ConfigStateService);
5115
5117
  const platformId = inject(PLATFORM_ID);
5116
5118
  let { requiredPolicy } = route.data || {};
5117
5119
  if (!requiredPolicy) {
@@ -5125,7 +5127,7 @@ const permissionGuard = (route, state) => {
5125
5127
  if (isPlatformServer(platformId)) {
5126
5128
  return of(true);
5127
5129
  }
5128
- return permissionService.getGrantedPolicy$(requiredPolicy).pipe(take(1), map(access => {
5130
+ return configStateService.getAll$().pipe(filter(config => !!config?.auth?.grantedPolicies), take(1), switchMap(() => permissionService.getGrantedPolicy$(requiredPolicy)), take(1), map(access => {
5129
5131
  if (access)
5130
5132
  return true;
5131
5133
  if (route.data?.['redirectUrl']) {