SUPPORT-8706: add check auth
This commit is contained in:
parent
23816a2f7e
commit
9b0950a21b
2 changed files with 21 additions and 21 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from "@angular/core";
|
||||||
import {HttpClient} from "@angular/common/http";
|
import {HttpClient} from "@angular/common/http";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
|
import {AuthenticationService} from "../../modules/security/authentication.service";
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|
@ -8,26 +9,30 @@ import {Router} from "@angular/router";
|
||||||
})
|
})
|
||||||
export class AuditService {
|
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 {
|
public logActionAudit(eventType: string, fileName?: string): void {
|
||||||
const currentRoute = this.router.url;
|
if (this.authService.isAuthenticated()) {
|
||||||
const sourceUrl = window.location.href;
|
const currentRoute = this.router.url;
|
||||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
const sourceUrl = window.location.href;
|
||||||
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
|
||||||
const data: AuditAction = {
|
const data: AuditAction = {
|
||||||
eventType: eventType,
|
eventType: eventType,
|
||||||
sourceUrl: sourceUrl,
|
sourceUrl: sourceUrl,
|
||||||
route: currentRoute,
|
route: currentRoute,
|
||||||
fileName: fileName
|
fileName: fileName
|
||||||
};
|
};
|
||||||
|
|
||||||
this.httpClient.post("audit/action", data, {
|
this.httpClient.post("audit/action", data, {
|
||||||
headers: {
|
headers: {
|
||||||
"Client-Time-Zone": timeZone,
|
"Client-Time-Zone": timeZone,
|
||||||
}
|
}
|
||||||
}).toPromise();
|
}).toPromise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,7 @@ export class WebbpmComponent {
|
||||||
|| event instanceof NavigationError
|
|| event instanceof NavigationError
|
||||||
|| event instanceof NavigationCancel) {
|
|| event instanceof NavigationCancel) {
|
||||||
progressIndicationService.hideProgressBar();
|
progressIndicationService.hideProgressBar();
|
||||||
|
this.auditService.logActionAudit(AuditConstants.OPEN_PAGE_EVENT);
|
||||||
if (event instanceof NavigationEnd
|
|
||||||
&& event.url != '/home'
|
|
||||||
&& event.url != '/access-denied') {
|
|
||||||
this.auditService.logActionAudit(AuditConstants.OPEN_PAGE_EVENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue