Skip to content

Commit

Permalink
Merge pull request #114 from GSA/bugfix/admin_guard
Browse files Browse the repository at this point in the history
Bugfix/admin guard for analytics to be visible to only admin users
  • Loading branch information
gsa-bri authored May 9, 2024
2 parents 90593a4 + 96f640b commit c9d2986
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/admin-guard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export class AdminGuard implements CanActivate {
* @param state
*/
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (!(this.authGuard.canActivate(route, state) && this.authGuard.isGSAAdmin)) {
this.router.navigate(['/auth']).catch(r => console.log(r));
}

return this.authGuard.canActivate(route, state) && this.authGuard.isGSAAdmin;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/app/auth-guard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class AuthGuard implements CanActivate {
}
});
}
return false
}

/**
Expand Down

0 comments on commit c9d2986

Please sign in to comment.