SUPPORT-8706: add check auth

This commit is contained in:
adel.ka 2025-03-04 10:08:03 +03:00
parent 23816a2f7e
commit 9b0950a21b
2 changed files with 21 additions and 21 deletions

View file

@ -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();
}
}
}

View file

@ -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);
}
})
}