diff --git a/frontend/src/ts/ervu/service/AuditService.ts b/frontend/src/ts/ervu/service/AuditService.ts index a0a4263..da2d306 100644 --- a/frontend/src/ts/ervu/service/AuditService.ts +++ b/frontend/src/ts/ervu/service/AuditService.ts @@ -1,6 +1,7 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {Router} from "@angular/router"; +import {AuthenticationService} from "../../modules/security/authentication.service"; @Injectable({ @@ -8,26 +9,30 @@ import {Router} from "@angular/router"; }) export class AuditService { - constructor(private httpClient: HttpClient, private router: Router) { + constructor(private httpClient: HttpClient, + private router: Router, + private authService: AuthenticationService) { } public logActionAudit(eventType: string, fileName?: string): void { - const currentRoute = this.router.url; - const sourceUrl = window.location.href; - const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; + if (this.authService.isAuthenticated()) { + const currentRoute = this.router.url; + const sourceUrl = window.location.href; + const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; - const data: AuditAction = { - eventType: eventType, - sourceUrl: sourceUrl, - route: currentRoute, - fileName: fileName - }; + const data: AuditAction = { + eventType: eventType, + sourceUrl: sourceUrl, + route: currentRoute, + fileName: fileName + }; - this.httpClient.post("audit/action", data, { - headers: { - "Client-Time-Zone": timeZone, - } - }).toPromise(); + this.httpClient.post("audit/action", data, { + headers: { + "Client-Time-Zone": timeZone, + } + }).toPromise(); + } } } diff --git a/frontend/src/ts/modules/webbpm/component/webbpm.component.ts b/frontend/src/ts/modules/webbpm/component/webbpm.component.ts index 8f0e990..279808d 100644 --- a/frontend/src/ts/modules/webbpm/component/webbpm.component.ts +++ b/frontend/src/ts/modules/webbpm/component/webbpm.component.ts @@ -34,12 +34,7 @@ export class WebbpmComponent { || event instanceof NavigationError || event instanceof NavigationCancel) { progressIndicationService.hideProgressBar(); - - if (event instanceof NavigationEnd - && event.url != '/home' - && event.url != '/access-denied') { - this.auditService.logActionAudit(AuditConstants.OPEN_PAGE_EVENT); - } + this.auditService.logActionAudit(AuditConstants.OPEN_PAGE_EVENT); } }) }