mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
21 lines
772 B
TypeScript
21 lines
772 B
TypeScript
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
import { Observable } from 'rxjs';
|
|
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service';
|
|
import { FeatureID } from '../data/feature-authorization/feature-id';
|
|
import { Injectable } from '@angular/core';
|
|
|
|
/**
|
|
* An guard for redirecting users to the feedback page if user is authorized
|
|
*/
|
|
@Injectable()
|
|
export class FeedbackGuard implements CanActivate {
|
|
|
|
constructor(private authorizationService: AuthorizationDataService) {
|
|
}
|
|
|
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
|
|
return this.authorizationService.isAuthorized(FeatureID.CanSendFeedback);
|
|
}
|
|
|
|
}
|