mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACA-1543] Quick Share - Non-logged user can't see the content of a shared file (#503)
* resolve guard * lint * fix errors
This commit is contained in:
committed by
Denys Vuika
parent
382b459ac8
commit
64b0790a0d
@@ -1,20 +1,35 @@
|
|||||||
import { CanActivate, ActivatedRouteSnapshot } from '@angular/router';
|
import { CanActivate, ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExperimentalGuard implements CanActivate {
|
export class ExperimentalGuard implements CanActivate {
|
||||||
constructor(private config: AppConfigService) {}
|
constructor(
|
||||||
|
private config: AppConfigService,
|
||||||
|
private storage: StorageService,
|
||||||
|
private router: Router
|
||||||
|
) {}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot) {
|
canActivate(route: ActivatedRouteSnapshot) {
|
||||||
const key = `experimental.${route.data.ifExperimentalKey}`;
|
const key = `experimental.${route.data.ifExperimentalKey}`;
|
||||||
const value = this.config.get(key);
|
const value = this.config.get(key);
|
||||||
|
const override = this.storage.getItem(key);
|
||||||
|
|
||||||
|
if (override === 'true') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
return value === true || value === 'true';
|
if (value === true || value === 'true') {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.router.navigate(['/']);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.router.navigate(['/']);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user