forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DSpace#2624][DURACOM-204] Created new guard for forgot route
(cherry picked from commit 0e4151e)
- Loading branch information
1 parent
c03edee
commit 0a2336a
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/app/core/rest-property/forgot-password-check-guard.guard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; | ||
import { Observable, of } from 'rxjs'; | ||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service'; | ||
import { FeatureID } from '../data/feature-authorization/feature-id'; | ||
import { | ||
SingleFeatureAuthorizationGuard | ||
} from '../data/feature-authorization/feature-authorization-guard/single-feature-authorization.guard'; | ||
import { AuthService } from '../auth/auth.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
/** | ||
* Guard that checks if the forgot-password feature is enabled | ||
*/ | ||
export class ForgotPasswordCheckGuard extends SingleFeatureAuthorizationGuard { | ||
|
||
constructor( | ||
protected readonly authorizationService: AuthorizationDataService, | ||
protected readonly router: Router, | ||
protected readonly authService: AuthService | ||
) { | ||
super(authorizationService, router, authService); | ||
} | ||
|
||
getFeatureID(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<FeatureID> { | ||
return of(FeatureID.EPersonForgotPassword); | ||
} | ||
|
||
} |