115279: Replaced EndUserAgreeMent guards with functional guards

This commit is contained in:
lotte
2024-05-23 15:30:15 +02:00
parent ffe30628ec
commit 553bada77d
8 changed files with 152 additions and 147 deletions

View File

@@ -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',