From 553bada77d4a47415f70071f35624938f932a21d Mon Sep 17 00:00:00 2001 From: lotte Date: Thu, 23 May 2024 15:30:15 +0200 Subject: [PATCH] 115279: Replaced EndUserAgreeMent guards with functional guards --- src/app/app-routes.ts | 55 +++++++++---------- .../abstract-end-user-agreement.guard.ts | 45 --------------- .../end-user-agreement-cookie.guard.spec.ts | 27 ++++++--- .../end-user-agreement-cookie.guard.ts | 38 +++++-------- ...-user-agreement-current-user.guard.spec.ts | 46 ++++++++++++---- .../end-user-agreement-current-user.guard.ts | 45 ++++++--------- .../end-user-agreement.guard.ts | 34 ++++++++++++ src/app/register-page/register-page-routes.ts | 9 +-- 8 files changed, 152 insertions(+), 147 deletions(-) delete mode 100644 src/app/core/end-user-agreement/abstract-end-user-agreement.guard.ts create mode 100644 src/app/core/end-user-agreement/end-user-agreement.guard.ts diff --git a/src/app/app-routes.ts b/src/app/app-routes.ts index 9f9dae2b6bc..29a78364b53 100644 --- a/src/app/app-routes.ts +++ b/src/app/app-routes.ts @@ -1,6 +1,5 @@ import { InMemoryScrollingOptions, - mapToCanActivate, Route, RouterConfigOptions, } from '@angular/router'; @@ -29,7 +28,7 @@ import { authenticatedGuard } from './core/auth/authenticated.guard'; import { groupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard'; import { siteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; import { siteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard'; -import { EndUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard'; +import { endUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard'; import { reloadGuard } from './core/reload/reload.guard'; import { forgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard'; import { ServerCheckGuard } from './core/server-check/server-check.guard'; @@ -66,25 +65,25 @@ export const APP_ROUTES: Route[] = [ .then((m) => m.ROUTES), data: { showBreadcrumbs: false }, providers: [provideSuggestionNotificationsState()], - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'community-list', loadChildren: () => import('./community-list-page/community-list-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'id', loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'handle', loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: REGISTER_PATH, @@ -96,75 +95,75 @@ export const APP_ROUTES: Route[] = [ path: FORGOT_PASSWORD_PATH, loadChildren: () => import('./forgot-password/forgot-password-routes') .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard, forgotPasswordCheckGuard], + canActivate: [endUserAgreementCurrentUserGuard, forgotPasswordCheckGuard], }, { path: COMMUNITY_MODULE_PATH, loadChildren: () => import('./community-page/community-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: COLLECTION_MODULE_PATH, loadChildren: () => import('./collection-page/collection-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: ITEM_MODULE_PATH, loadChildren: () => import('./item-page/item-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'entities/:entity-type', loadChildren: () => import('./item-page/item-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: LEGACY_BITSTREAM_MODULE_PATH, loadChildren: () => import('./bitstream-page/bitstream-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: BITSTREAM_MODULE_PATH, loadChildren: () => import('./bitstream-page/bitstream-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'mydspace', loadChildren: () => import('./my-dspace-page/my-dspace-page-routes') .then((m) => m.ROUTES), providers: [provideSuggestionNotificationsState()], - canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], + canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard], }, { path: 'search', loadChildren: () => import('./search-page/search-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'browse', loadChildren: () => import('./browse-by/browse-by-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: ADMIN_MODULE_PATH, loadChildren: () => import('./admin/admin-routes') .then((m) => m.ROUTES), - canActivate: [siteAdministratorGuard, EndUserAgreementCurrentUserGuard], + canActivate: [siteAdministratorGuard, endUserAgreementCurrentUserGuard], }, { path: NOTIFICATIONS_MODULE_PATH, loadChildren: () => import('./quality-assurance-notifications-pages/notifications-pages-routes') .then((m) => m.ROUTES), providers: [provideSuggestionNotificationsState()], - canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], + canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard], }, { path: 'login', @@ -181,47 +180,47 @@ export const APP_ROUTES: Route[] = [ loadChildren: () => import('./submit-page/submit-page-routes') .then((m) => m.ROUTES), providers: [provideSubmissionState()], - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'import-external', loadChildren: () => import('./import-external-page/import-external-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: 'workspaceitems', loadChildren: () => import('./workspaceitems-edit-page/workspaceitems-edit-page-routes') .then((m) => m.ROUTES), providers: [provideSubmissionState()], - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: WORKFLOW_ITEM_MODULE_PATH, providers: [provideSubmissionState()], loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: PROFILE_MODULE_PATH, loadChildren: () => import('./profile-page/profile-page-routes') .then((m) => m.ROUTES), providers: [provideSuggestionNotificationsState()], - canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], + canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard], }, { path: PROCESS_MODULE_PATH, loadChildren: () => import('./process-page/process-page-routes') .then((m) => m.ROUTES), - canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], + canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard], }, { path: SUGGESTION_MODULE_PATH, loadChildren: () => import('./suggestions-page/suggestions-page-routes') .then((m) => m.ROUTES), providers: [provideSuggestionNotificationsState()], - canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], + canActivate: [authenticatedGuard, endUserAgreementCurrentUserGuard], }, { path: INFO_MODULE_PATH, @@ -230,7 +229,7 @@ export const APP_ROUTES: Route[] = [ { path: REQUEST_COPY_MODULE_PATH, loadChildren: () => import('./request-copy/request-copy-routes').then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: FORBIDDEN_PATH, @@ -240,7 +239,7 @@ export const APP_ROUTES: Route[] = [ path: 'statistics', loadChildren: () => import('./statistics-page/statistics-page-routes') .then((m) => m.ROUTES), - canActivate: mapToCanActivate([EndUserAgreementCurrentUserGuard]), + canActivate: [endUserAgreementCurrentUserGuard], }, { path: HEALTH_PAGE_PATH, @@ -250,7 +249,7 @@ export const APP_ROUTES: Route[] = [ { path: ACCESS_CONTROL_MODULE_PATH, loadChildren: () => import('./access-control/access-control-routes').then((m) => m.ROUTES), - canActivate: [groupAdministratorGuard, EndUserAgreementCurrentUserGuard], + canActivate: [groupAdministratorGuard, endUserAgreementCurrentUserGuard], }, { path: 'subscriptions', diff --git a/src/app/core/end-user-agreement/abstract-end-user-agreement.guard.ts b/src/app/core/end-user-agreement/abstract-end-user-agreement.guard.ts deleted file mode 100644 index 2937011a380..00000000000 --- a/src/app/core/end-user-agreement/abstract-end-user-agreement.guard.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - ActivatedRouteSnapshot, - Router, - RouterStateSnapshot, - UrlTree, -} from '@angular/router'; -import { - Observable, - of as observableOf, -} from 'rxjs'; - -import { environment } from '../../../environments/environment'; -import { returnEndUserAgreementUrlTreeOnFalse } from '../shared/authorized.operators'; - -/** - * An abstract guard for redirecting users to the user agreement page if a certain condition is met - * That condition is defined by abstract method hasAccepted - */ -export abstract class AbstractEndUserAgreementGuard { - - constructor(protected router: Router) { - } - - /** - * True when the user agreement has been accepted - * The user will be redirected to the End User Agreement page if they haven't accepted it before - * A redirect URL will be provided with the navigation so the component can redirect the user back to the blocked route - * when they're finished accepting the agreement - */ - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - if (!environment.info.enableEndUserAgreement) { - return observableOf(true); - } - return this.hasAccepted().pipe( - returnEndUserAgreementUrlTreeOnFalse(this.router, state.url), - ); - } - - /** - * This abstract method determines how the User Agreement has to be accepted before the user is allowed to visit - * the desired route - */ - abstract hasAccepted(): Observable; - -} diff --git a/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.spec.ts b/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.spec.ts index a801fb7a6fa..640859c7a42 100644 --- a/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.spec.ts +++ b/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.spec.ts @@ -1,13 +1,14 @@ +import { TestBed } from '@angular/core/testing'; import { Router, UrlTree, } from '@angular/router'; +import { Observable } from 'rxjs'; import { EndUserAgreementService } from './end-user-agreement.service'; -import { EndUserAgreementCookieGuard } from './end-user-agreement-cookie.guard'; +import { endUserAgreementCookieGuard } from './end-user-agreement-cookie.guard'; -describe('EndUserAgreementCookieGuard', () => { - let guard: EndUserAgreementCookieGuard; +describe('endUserAgreementCookieGuard', () => { let endUserAgreementService: EndUserAgreementService; let router: Router; @@ -21,14 +22,22 @@ describe('EndUserAgreementCookieGuard', () => { parseUrl: new UrlTree(), createUrlTree: new UrlTree(), }); - - guard = new EndUserAgreementCookieGuard(endUserAgreementService, router); + TestBed.configureTestingModule({ + providers: [ + { provide: Router, useValue: router }, + { provide: EndUserAgreementService, useValue: endUserAgreementService }, + ], + }); }); describe('canActivate', () => { describe('when the cookie has been accepted', () => { it('should return true', (done) => { - guard.canActivate(undefined, { url: Object.assign({ url: 'redirect' }) } as any).subscribe((result) => { + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCookieGuard(undefined, { url: Object.assign({ url: 'redirect' }) } as any); + }) as Observable; + + result$.subscribe((result) => { expect(result).toEqual(true); done(); }); @@ -41,7 +50,11 @@ describe('EndUserAgreementCookieGuard', () => { }); it('should return a UrlTree', (done) => { - guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => { + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCookieGuard(undefined, { url: Object.assign({ url: 'redirect' }) } as any); + }) as Observable; + + result$.subscribe((result) => { expect(result).toEqual(jasmine.any(UrlTree)); done(); }); diff --git a/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.ts b/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.ts index 3eccae3ca9e..2da38fb22dc 100644 --- a/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.ts +++ b/src/app/core/end-user-agreement/end-user-agreement-cookie.guard.ts @@ -1,29 +1,19 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; -import { - Observable, - of as observableOf, -} from 'rxjs'; +import { inject } from '@angular/core'; +import { CanActivateFn } from '@angular/router'; +import { of as observableOf } from 'rxjs'; -import { AbstractEndUserAgreementGuard } from './abstract-end-user-agreement.guard'; +import { endUserAgreementGuard } from './end-user-agreement.guard'; import { EndUserAgreementService } from './end-user-agreement.service'; + /** - * A guard redirecting users to the end agreement page when the user agreement cookie hasn't been accepted + * Guard for preventing unauthorized access to certain pages + * requiring the end user agreement to have been accepted in a cookie */ -@Injectable({ providedIn: 'root' }) -export class EndUserAgreementCookieGuard extends AbstractEndUserAgreementGuard { - - constructor(protected endUserAgreementService: EndUserAgreementService, - protected router: Router) { - super(router); - } - - /** - * True when the user agreement cookie has been accepted - */ - hasAccepted(): Observable { - return observableOf(this.endUserAgreementService.isCookieAccepted()); - } - -} +export const endUserAgreementCookieGuard: CanActivateFn = + endUserAgreementGuard( + () => { + const endUserAgreementService = inject(EndUserAgreementService); + return observableOf(endUserAgreementService.isCookieAccepted()); + }, + ); diff --git a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts index 88722bd799e..ae1f63884f2 100644 --- a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts +++ b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts @@ -1,16 +1,18 @@ +import { TestBed } from '@angular/core/testing'; import { Router, UrlTree, } from '@angular/router'; -import { of as observableOf } from 'rxjs'; +import { + Observable, + of as observableOf, +} from 'rxjs'; import { environment } from '../../../environments/environment.test'; import { EndUserAgreementService } from './end-user-agreement.service'; -import { EndUserAgreementCurrentUserGuard } from './end-user-agreement-current-user.guard'; - -describe('EndUserAgreementGuard', () => { - let guard: EndUserAgreementCurrentUserGuard; +import { endUserAgreementCurrentUserGuard } from './end-user-agreement-current-user.guard'; +describe('endUserAgreementGuard', () => { let endUserAgreementService: EndUserAgreementService; let router: Router; @@ -18,19 +20,30 @@ describe('EndUserAgreementGuard', () => { endUserAgreementService = jasmine.createSpyObj('endUserAgreementService', { hasCurrentUserAcceptedAgreement: observableOf(true), }); + router = jasmine.createSpyObj('router', { navigateByUrl: {}, parseUrl: new UrlTree(), createUrlTree: new UrlTree(), }); - guard = new EndUserAgreementCurrentUserGuard(endUserAgreementService, router); + TestBed.configureTestingModule({ + providers: [ + { provide: Router, useValue: router }, + { provide: EndUserAgreementService, useValue: endUserAgreementService }, + ], + }); + }); describe('canActivate', () => { describe('when the user has accepted the agreement', () => { it('should return true', (done) => { - guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => { + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCurrentUserGuard(undefined, Object.assign({ url: 'redirect' })); + }) as Observable; + + result$.subscribe((result) => { expect(result).toEqual(true); done(); }); @@ -43,7 +56,11 @@ describe('EndUserAgreementGuard', () => { }); it('should return a UrlTree', (done) => { - guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => { + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCurrentUserGuard(undefined, Object.assign({ url: 'redirect' })); + }) as Observable; + + result$.subscribe((result) => { expect(result).toEqual(jasmine.any(UrlTree)); done(); }); @@ -53,7 +70,12 @@ describe('EndUserAgreementGuard', () => { describe('when the end user agreement is disabled', () => { it('should return true', (done) => { environment.info.enableEndUserAgreement = false; - guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => { + + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCurrentUserGuard(undefined, Object.assign({ url: 'redirect' })); + }) as Observable; + + result$.subscribe((result) => { expect(result).toEqual(true); done(); }); @@ -61,7 +83,11 @@ describe('EndUserAgreementGuard', () => { it('should not resolve to the end user agreement page', (done) => { environment.info.enableEndUserAgreement = false; - guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => { + const result$ = TestBed.runInInjectionContext(() => { + return endUserAgreementCurrentUserGuard(undefined, Object.assign({ url: 'redirect' })); + }) as Observable; + + result$.subscribe((result) => { expect(router.navigateByUrl).not.toHaveBeenCalled(); done(); }); diff --git a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.ts b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.ts index 566f0494503..7c190a08b3c 100644 --- a/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.ts +++ b/src/app/core/end-user-agreement/end-user-agreement-current-user.guard.ts @@ -1,34 +1,25 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; -import { - Observable, - of as observableOf, -} from 'rxjs'; +import { inject } from '@angular/core'; +import { CanActivateFn } from '@angular/router'; +import { of as observableOf } from 'rxjs'; import { environment } from '../../../environments/environment'; -import { AbstractEndUserAgreementGuard } from './abstract-end-user-agreement.guard'; +import { endUserAgreementGuard } from './end-user-agreement.guard'; import { EndUserAgreementService } from './end-user-agreement.service'; -/** - * A guard redirecting logged in users to the end agreement page when they haven't accepted the latest user agreement - */ -@Injectable({ providedIn: 'root' }) -export class EndUserAgreementCurrentUserGuard extends AbstractEndUserAgreementGuard { - - constructor(protected endUserAgreementService: EndUserAgreementService, - protected router: Router) { - super(router); - } - /** - * True when the currently logged in user has accepted the agreements or when the user is not currently authenticated - */ - hasAccepted(): Observable { - if (!environment.info.enableEndUserAgreement) { - return observableOf(true); - } +/** + * Guard for preventing unauthorized access to certain pages + * requiring the end user agreement to have been accepted by the current user - return this.endUserAgreementService.hasCurrentUserAcceptedAgreement(true); - } + */ +export const endUserAgreementCurrentUserGuard: CanActivateFn = + endUserAgreementGuard( + () => { + const endUserAgreementService = inject(EndUserAgreementService); + if (!environment.info.enableEndUserAgreement) { + return observableOf(true); + } -} + return endUserAgreementService.hasCurrentUserAcceptedAgreement(true); + }, + ); diff --git a/src/app/core/end-user-agreement/end-user-agreement.guard.ts b/src/app/core/end-user-agreement/end-user-agreement.guard.ts new file mode 100644 index 00000000000..911dd54e259 --- /dev/null +++ b/src/app/core/end-user-agreement/end-user-agreement.guard.ts @@ -0,0 +1,34 @@ +import { inject } from '@angular/core'; +import { + ActivatedRouteSnapshot, + CanActivateFn, + Router, + RouterStateSnapshot, + UrlTree, +} from '@angular/router'; +import { + Observable, + of as observableOf, +} from 'rxjs'; + +import { environment } from '../../../environments/environment'; +import { returnEndUserAgreementUrlTreeOnFalse } from '../shared/authorized.operators'; + +export declare type HasAcceptedGuardParamFn = () => Observable; +/** + * Guard for preventing activating when the user has not accepted the EndUserAgreement + * @param hasAccepted Function determining if the EndUserAgreement has been accepted + */ +export const endUserAgreementGuard = ( + hasAccepted: HasAcceptedGuardParamFn, +): CanActivateFn => { + return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable => { + const router = inject(Router); + if (!environment.info.enableEndUserAgreement) { + return observableOf(true); + } + return hasAccepted().pipe( + returnEndUserAgreementUrlTreeOnFalse(router, state.url), + ); + }; +}; diff --git a/src/app/register-page/register-page-routes.ts b/src/app/register-page/register-page-routes.ts index 109ed24c6d7..e7ca386aac8 100644 --- a/src/app/register-page/register-page-routes.ts +++ b/src/app/register-page/register-page-routes.ts @@ -1,9 +1,6 @@ -import { - mapToCanActivate, - Route, -} from '@angular/router'; +import { Route } from '@angular/router'; -import { EndUserAgreementCookieGuard } from '../core/end-user-agreement/end-user-agreement-cookie.guard'; +import { endUserAgreementCookieGuard } from '../core/end-user-agreement/end-user-agreement-cookie.guard'; import { ThemedCreateProfileComponent } from './create-profile/themed-create-profile.component'; import { ThemedRegisterEmailComponent } from './register-email/themed-register-email.component'; import { registrationGuard } from './registration.guard'; @@ -20,7 +17,7 @@ export const ROUTES: Route[] = [ component: ThemedCreateProfileComponent, canActivate: [ registrationGuard, - ...mapToCanActivate([EndUserAgreementCookieGuard]), + endUserAgreementCookieGuard, ], }, ];