Commits
Tim Donohue authored 35614d14739
12 12 | * Override the desired getters in the parent class for checking specific authorization on a list of features and/or object. |
13 13 | */ |
14 14 | export abstract class SomeFeatureAuthorizationGuard implements CanActivate { |
15 15 | constructor(protected authorizationService: AuthorizationDataService, |
16 16 | protected router: Router, |
17 17 | protected authService: AuthService) { |
18 18 | } |
19 19 | |
20 20 | /** |
21 21 | * True when user has authorization rights for the feature and object provided |
22 - | * Redirect the user to the unauthorized page when he/she's not authorized for the given feature |
22 + | * Redirect the user to the unauthorized page when they are not authorized for the given feature |
23 23 | */ |
24 24 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> { |
25 25 | return observableCombineLatest(this.getFeatureIDs(route, state), this.getObjectUrl(route, state), this.getEPersonUuid(route, state)).pipe( |
26 26 | switchMap(([featureIDs, objectUrl, ePersonUuid]) => |
27 27 | observableCombineLatest(featureIDs.map((featureID) => this.authorizationService.isAuthorized(featureID, objectUrl, ePersonUuid))) |
28 28 | ), |
29 29 | returnForbiddenUrlTreeOrLoginOnAllFalse(this.router, this.authService, state.url) |
30 30 | ); |
31 31 | } |
32 32 | |