SUPPORT-8706: add auth check
This commit is contained in:
parent
71915d4616
commit
49752b4f2a
2 changed files with 21 additions and 21 deletions
|
|
@ -1,31 +1,36 @@
|
|||
import {Injectable} from "@angular/core";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {Router} from "@angular/router";
|
||||
import {AuthenticationService} from "../../modules/security/authentication.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root"
|
||||
})
|
||||
export class AuditService {
|
||||
constructor(private httpClient: HttpClient, private router: Router) {
|
||||
constructor(private httpClient: HttpClient,
|
||||
private router: Router,
|
||||
private authService: AuthenticationService) {
|
||||
}
|
||||
|
||||
public logActionAudit(eventType: string, filterInfo?: Record<string, FilterInfo>,
|
||||
fileName?: string): void {
|
||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const route = this.router.url;
|
||||
const sourceUrl = window.location.href;
|
||||
const auditEvent: AuditAction = {
|
||||
eventType: eventType,
|
||||
route: route,
|
||||
sourceUrl: sourceUrl,
|
||||
filterInfo: filterInfo,
|
||||
fileName: fileName
|
||||
}
|
||||
this.httpClient.post("audit/action", auditEvent, {
|
||||
headers: {
|
||||
"Client-Time-Zone": timeZone,
|
||||
if (this.authService.isAuthenticated()) {
|
||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const route = this.router.url;
|
||||
const sourceUrl = window.location.href;
|
||||
const auditEvent: AuditAction = {
|
||||
eventType: eventType,
|
||||
route: route,
|
||||
sourceUrl: sourceUrl,
|
||||
filterInfo: filterInfo,
|
||||
fileName: fileName
|
||||
}
|
||||
}).toPromise();
|
||||
this.httpClient.post("audit/action", auditEvent, {
|
||||
headers: {
|
||||
"Client-Time-Zone": timeZone,
|
||||
}
|
||||
}).toPromise();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue