Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import OAuthService to solve build error #18066

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { tap } from 'rxjs/operators';
import { AuthService, IAbpGuard } from '../abstracts';
import { findRoute, getRoutePath } from '../utils/route-utils';
import { RoutesService, PermissionService, HttpErrorReporterService } from '../services';

/**
* @deprecated Use `permissionGuard` *function* instead.
*/
Expand Down Expand Up @@ -51,7 +50,7 @@ export const permissionGuard: CanActivateFn = (
) => {
const router = inject(Router);
const routesService = inject(RoutesService);
const oAuthService = inject(OAuthService);
const oAuthService = inject(AuthService);
Sinan997 marked this conversation as resolved.
Show resolved Hide resolved
const permissionService = inject(PermissionService);
const httpErrorReporter = inject(HttpErrorReporterService);

Expand All @@ -66,7 +65,7 @@ export const permissionGuard: CanActivateFn = (

return permissionService.getGrantedPolicy$(requiredPolicy).pipe(
tap(access => {
if (!access && oAuthService.hasValidAccessToken()) {
if (!access && oAuthService.isAuthenticated) {
httpErrorReporter.reportError({ status: 403 } as HttpErrorResponse);
}
}),
Expand Down
Loading