|
|
|
@ -20,7 +20,7 @@ import { RoutesService, PermissionService, HttpErrorReporterService } from '../s |
|
|
|
export class PermissionGuard implements IAbpGuard { |
|
|
|
protected readonly router = inject(Router); |
|
|
|
protected readonly routesService = inject(RoutesService); |
|
|
|
protected readonly oAuthService = inject(AuthService); |
|
|
|
protected readonly authService = inject(AuthService); |
|
|
|
protected readonly permissionService = inject(PermissionService); |
|
|
|
protected readonly httpErrorReporter = inject(HttpErrorReporterService); |
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ export class PermissionGuard implements IAbpGuard { |
|
|
|
|
|
|
|
return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe( |
|
|
|
tap(access => { |
|
|
|
if (!access && this.oAuthService.isAuthenticated) { |
|
|
|
if (!access && this.authService.isAuthenticated) { |
|
|
|
this.httpErrorReporter.reportError({ status: 403 } as HttpErrorResponse); |
|
|
|
} |
|
|
|
}), |
|
|
|
@ -50,7 +50,7 @@ export const permissionGuard: CanActivateFn = ( |
|
|
|
) => { |
|
|
|
const router = inject(Router); |
|
|
|
const routesService = inject(RoutesService); |
|
|
|
const oAuthService = inject(AuthService); |
|
|
|
const authService = inject(AuthService); |
|
|
|
const permissionService = inject(PermissionService); |
|
|
|
const httpErrorReporter = inject(HttpErrorReporterService); |
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ export const permissionGuard: CanActivateFn = ( |
|
|
|
|
|
|
|
return permissionService.getGrantedPolicy$(requiredPolicy).pipe( |
|
|
|
tap(access => { |
|
|
|
if (!access && oAuthService.isAuthenticated) { |
|
|
|
if (!access && authService.isAuthenticated) { |
|
|
|
httpErrorReporter.reportError({ status: 403 } as HttpErrorResponse); |
|
|
|
} |
|
|
|
}), |
|
|
|
|