Files
alfresco-content-app/projects/aca-content/src/lib/components/view-profile/view-profile.guard.ts
SheenaMalhotra182 8d2e7df738 linting fixes
2023-03-31 19:28:30 +05:30

27 lines
958 B
TypeScript

/*
* Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { AuthenticationService } from '@alfresco/adf-core';
@Injectable({
providedIn: 'root'
})
export class ViewProfileRuleGuard implements CanActivate {
constructor(private authService: AuthenticationService) {}
canActivate(_: ActivatedRouteSnapshot): Observable<boolean> | Promise<boolean> | boolean {
return this.isEcmLoggedIn() || this.authService.isOauth();
}
private isEcmLoggedIn() {
return this.authService.isEcmLoggedIn() || (this.authService.isECMProvider() && this.authService.isKerberosEnabled());
}
}