Merge branch 'develop' into feature/ERVU-590
This commit is contained in:
commit
84cfb974f4
9 changed files with 79 additions and 43 deletions
|
|
@ -1,15 +1,34 @@
|
|||
import {Behavior, Visible} from "@webbpm/base-package";
|
||||
import {CookieService} from "ngx-cookie";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {AuthenticationService} from "../modules/security/authentication.service";
|
||||
|
||||
export class FileUploadChecker extends Behavior {
|
||||
private cookieService: CookieService;
|
||||
private httpClient: HttpClient;
|
||||
private authService: AuthenticationService;
|
||||
private allowed: boolean = false;
|
||||
|
||||
initialize() {
|
||||
this.cookieService = this.injector.get(CookieService);
|
||||
this.httpClient = this.injector.get(HttpClient);
|
||||
this.authService = this.injector.get(AuthenticationService);
|
||||
}
|
||||
|
||||
postStart() {
|
||||
super.postStart();
|
||||
if (this.authService.isAuthenticated()){
|
||||
this.checkUploadPermission();
|
||||
}
|
||||
}
|
||||
|
||||
@Visible()
|
||||
public fileUploadAllowed(): boolean {
|
||||
return this.cookieService.get("upload_allowed") != null;
|
||||
return this.allowed;
|
||||
}
|
||||
|
||||
private checkUploadPermission(): void {
|
||||
this.httpClient.get<boolean>('upload/access')
|
||||
.toPromise()
|
||||
.then(response => {
|
||||
this.allowed = response;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue