[DURACOM-234] rename guards in order to be complaint to function name convention

This commit is contained in:
Giuseppe Digilio
2024-04-03 18:57:11 +02:00
parent f1686d5499
commit 35714b7a45
43 changed files with 119 additions and 119 deletions

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard'; import { authenticatedGuard } from '../../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
import { qualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver'; import { qualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
import { AdminNotificationsPublicationClaimPageResolver } from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service'; import { AdminNotificationsPublicationClaimPageResolver } from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service';
@@ -19,7 +19,7 @@ import {
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [ AuthenticatedGuard ], canActivate: [ authenticatedGuard ],
path: `${PUBLICATION_CLAIMS_PATH}`, path: `${PUBLICATION_CLAIMS_PATH}`,
component: AdminNotificationsPublicationClaimPageComponent, component: AdminNotificationsPublicationClaimPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -34,7 +34,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
component: QualityAssuranceTopicsPageComponent, component: QualityAssuranceTopicsPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -49,7 +49,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [ AuthenticatedGuard ], canActivate: [ authenticatedGuard ],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`,
component: QualityAssuranceTopicsPageComponent, component: QualityAssuranceTopicsPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -64,7 +64,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}`, path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
component: QualityAssuranceSourcePageComponent, component: QualityAssuranceSourcePageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -80,7 +80,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
component: QualityAssuranceEventsPageComponent, component: QualityAssuranceEventsPageComponent,
pathMatch: 'full', pathMatch: 'full',

View File

@@ -4,7 +4,7 @@ import {
} from '@angular/router'; } from '@angular/router';
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
import { NotifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard'; import { notifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard';
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component'; import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component'; import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
@@ -12,7 +12,7 @@ import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-o
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), NotifyInfoGuard], canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
path: '', path: '',
resolve: { resolve: {
breadcrumb: i18nBreadcrumbResolver, breadcrumb: i18nBreadcrumbResolver,
@@ -30,7 +30,7 @@ export const ROUTES: Route[] = [
breadcrumb: i18nBreadcrumbResolver, breadcrumb: i18nBreadcrumbResolver,
}, },
component: AdminNotifyIncomingComponent, component: AdminNotifyIncomingComponent,
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), NotifyInfoGuard], canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
data: { data: {
title: 'admin.notify.dashboard.page.title', title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard', breadcrumbKey: 'admin.notify.dashboard',
@@ -42,7 +42,7 @@ export const ROUTES: Route[] = [
breadcrumb: i18nBreadcrumbResolver, breadcrumb: i18nBreadcrumbResolver,
}, },
component: AdminNotifyOutgoingComponent, component: AdminNotifyOutgoingComponent,
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), NotifyInfoGuard], canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
data: { data: {
title: 'admin.notify.dashboard.page.title', title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard', breadcrumbKey: 'admin.notify.dashboard',

View File

@@ -24,13 +24,13 @@ import {
} from './app-routing-paths'; } from './app-routing-paths';
import { COLLECTION_MODULE_PATH } from './collection-page/collection-page-routing-paths'; import { COLLECTION_MODULE_PATH } from './collection-page/collection-page-routing-paths';
import { COMMUNITY_MODULE_PATH } from './community-page/community-page-routing-paths'; import { COMMUNITY_MODULE_PATH } from './community-page/community-page-routing-paths';
import { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; import { authBlockingGuard } from './core/auth/auth-blocking.guard';
import { AuthenticatedGuard } from './core/auth/authenticated.guard'; import { authenticatedGuard } from './core/auth/authenticated.guard';
import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.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 { 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 { 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 { reloadGuard } from './core/reload/reload.guard';
import { ForgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard'; import { ForgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard';
import { ServerCheckGuard } from './core/server-check/server-check.guard'; import { ServerCheckGuard } from './core/server-check/server-check.guard';
import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component'; import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component';
@@ -49,7 +49,7 @@ export const APP_ROUTES: Route[] = [
{ path: ERROR_PAGE, component: ThemedPageErrorComponent }, { path: ERROR_PAGE, component: ThemedPageErrorComponent },
{ {
path: '', path: '',
canActivate: [AuthBlockingGuard], canActivate: [authBlockingGuard],
canActivateChild: [ServerCheckGuard], canActivateChild: [ServerCheckGuard],
resolve: [menuResolver], resolve: [menuResolver],
children: [ children: [
@@ -58,7 +58,7 @@ export const APP_ROUTES: Route[] = [
path: 'reload/:rnd', path: 'reload/:rnd',
component: ThemedPageNotFoundComponent, component: ThemedPageNotFoundComponent,
pathMatch: 'full', pathMatch: 'full',
canActivate: [ReloadGuard], canActivate: [reloadGuard],
}, },
{ {
path: 'home', path: 'home',
@@ -139,7 +139,7 @@ export const APP_ROUTES: Route[] = [
loadChildren: () => import('./my-dspace-page/my-dspace-page-routes') loadChildren: () => import('./my-dspace-page/my-dspace-page-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
providers: [provideSuggestionNotificationsState()], providers: [provideSuggestionNotificationsState()],
canActivate: [AuthenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])],
}, },
{ {
path: 'search', path: 'search',
@@ -164,7 +164,7 @@ export const APP_ROUTES: Route[] = [
loadChildren: () => import('./quality-assurance-notifications-pages/notifications-pages-routes') loadChildren: () => import('./quality-assurance-notifications-pages/notifications-pages-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
providers: [provideSuggestionNotificationsState()], providers: [provideSuggestionNotificationsState()],
canActivate: [AuthenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])],
}, },
{ {
path: 'login', path: 'login',
@@ -208,20 +208,20 @@ export const APP_ROUTES: Route[] = [
loadChildren: () => import('./profile-page/profile-page-routes') loadChildren: () => import('./profile-page/profile-page-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
providers: [provideSuggestionNotificationsState()], providers: [provideSuggestionNotificationsState()],
canActivate: [AuthenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])],
}, },
{ {
path: PROCESS_MODULE_PATH, path: PROCESS_MODULE_PATH,
loadChildren: () => import('./process-page/process-page-routes') loadChildren: () => import('./process-page/process-page-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
canActivate: [AuthenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])],
}, },
{ {
path: SUGGESTION_MODULE_PATH, path: SUGGESTION_MODULE_PATH,
loadChildren: () => import('./suggestions-page/suggestions-page-routes') loadChildren: () => import('./suggestions-page/suggestions-page-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
providers: [provideSuggestionNotificationsState()], providers: [provideSuggestionNotificationsState()],
canActivate: [AuthenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([EndUserAgreementCurrentUserGuard])],
}, },
{ {
path: INFO_MODULE_PATH, path: INFO_MODULE_PATH,
@@ -256,7 +256,7 @@ export const APP_ROUTES: Route[] = [
path: 'subscriptions', path: 'subscriptions',
loadChildren: () => import('./subscriptions-page/subscriptions-page-routes') loadChildren: () => import('./subscriptions-page/subscriptions-page-routes')
.then((m) => m.ROUTES), .then((m) => m.ROUTES),
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
}, },
{ path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent }, { path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent },
], ],

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { bitstreamBreadcrumbResolver } from '../core/breadcrumbs/bitstream-breadcrumb.resolver'; import { bitstreamBreadcrumbResolver } from '../core/breadcrumbs/bitstream-breadcrumb.resolver';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ResourcePolicyCreateComponent } from '../shared/resource-policies/create/resource-policy-create.component'; import { ResourcePolicyCreateComponent } from '../shared/resource-policies/create/resource-policy-create.component';
@@ -51,7 +51,7 @@ export const ROUTES: Route[] = [
bitstream: bitstreamPageResolver, bitstream: bitstreamPageResolver,
breadcrumb: bitstreamBreadcrumbResolver, breadcrumb: bitstreamBreadcrumbResolver,
}, },
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
}, },
{ {
path: EDIT_BITSTREAM_AUTHORIZATIONS_PATH, path: EDIT_BITSTREAM_AUTHORIZATIONS_PATH,

View File

@@ -6,10 +6,10 @@ import {
createSuccessfulRemoteDataObject$, createSuccessfulRemoteDataObject$,
} from '../shared/remote-data.utils'; } from '../shared/remote-data.utils';
import { RouterStub } from '../shared/testing/router.stub'; import { RouterStub } from '../shared/testing/router.stub';
import { BrowseByGuard } from './browse-by-guard'; import { browseByGuard } from './browse-by-guard';
import { BrowseByDataType } from './browse-by-switcher/browse-by-data-type'; import { BrowseByDataType } from './browse-by-switcher/browse-by-data-type';
describe('BrowseByGuard', () => { describe('browseByGuard', () => {
describe('canActivate', () => { describe('canActivate', () => {
let guard: any; let guard: any;
let translateService: any; let translateService: any;
@@ -35,7 +35,7 @@ describe('BrowseByGuard', () => {
router = new RouterStub() as any; router = new RouterStub() as any;
guard = BrowseByGuard; guard = browseByGuard;
}); });
it('should return true, and sets up the data correctly, with a scope and value', () => { it('should return true, and sets up the data correctly, with a scope and value', () => {

View File

@@ -26,7 +26,7 @@ import {
hasValue, hasValue,
} from '../shared/empty.util'; } from '../shared/empty.util';
export const BrowseByGuard: CanActivateFn = ( export const browseByGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
browseDefinitionService: BrowseDefinitionDataService = inject(BrowseDefinitionDataService), browseDefinitionService: BrowseDefinitionDataService = inject(BrowseDefinitionDataService),

View File

@@ -2,7 +2,7 @@ import { Route } from '@angular/router';
import { dsoEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver'; import { dsoEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
import { browseByDSOBreadcrumbResolver } from './browse-by-dso-breadcrumb.resolver'; import { browseByDSOBreadcrumbResolver } from './browse-by-dso-breadcrumb.resolver';
import { BrowseByGuard } from './browse-by-guard'; import { browseByGuard } from './browse-by-guard';
import { browseByI18nBreadcrumbResolver } from './browse-by-i18n-breadcrumb.resolver'; import { browseByI18nBreadcrumbResolver } from './browse-by-i18n-breadcrumb.resolver';
import { BrowseByPageComponent } from './browse-by-page/browse-by-page.component'; import { BrowseByPageComponent } from './browse-by-page/browse-by-page.component';
@@ -17,7 +17,7 @@ export const ROUTES: Route[] = [
{ {
path: ':id', path: ':id',
component: BrowseByPageComponent, component: BrowseByPageComponent,
canActivate: [BrowseByGuard], canActivate: [browseByGuard],
resolve: { breadcrumb: browseByI18nBreadcrumbResolver }, resolve: { breadcrumb: browseByI18nBreadcrumbResolver },
data: { title: 'browse.title.page', breadcrumbKey: 'browse.metadata' }, data: { title: 'browse.title.page', breadcrumbKey: 'browse.metadata' },
}, },

View File

@@ -3,9 +3,9 @@ import {
Route, Route,
} from '@angular/router'; } from '@angular/router';
import { BrowseByGuard } from '../browse-by/browse-by-guard'; import { browseByGuard } from '../browse-by/browse-by-guard';
import { browseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver'; import { browseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { collectionBreadcrumbResolver } from '../core/breadcrumbs/collection-breadcrumb.resolver'; import { collectionBreadcrumbResolver } from '../core/breadcrumbs/collection-breadcrumb.resolver';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component'; import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
@@ -21,7 +21,7 @@ import {
ITEMTEMPLATE_PATH, ITEMTEMPLATE_PATH,
} from './collection-page-routing-paths'; } from './collection-page-routing-paths';
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component'; import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard'; import { createCollectionPageGuard } from './create-collection-page/create-collection-page.guard';
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component'; import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
import { itemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver'; import { itemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver';
import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component'; import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component';
@@ -32,7 +32,7 @@ export const ROUTES: Route[] = [
{ {
path: COLLECTION_CREATE_PATH, path: COLLECTION_CREATE_PATH,
component: CreateCollectionPageComponent, component: CreateCollectionPageComponent,
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard], canActivate: [authenticatedGuard, createCollectionPageGuard],
}, },
{ {
path: ':id', path: ':id',
@@ -53,12 +53,12 @@ export const ROUTES: Route[] = [
path: 'delete', path: 'delete',
pathMatch: 'full', pathMatch: 'full',
component: DeleteCollectionPageComponent, component: DeleteCollectionPageComponent,
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
}, },
{ {
path: ITEMTEMPLATE_PATH, path: ITEMTEMPLATE_PATH,
component: ThemedEditItemTemplatePageComponent, component: ThemedEditItemTemplatePageComponent,
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
resolve: { resolve: {
item: itemTemplatePageResolver, item: itemTemplatePageResolver,
breadcrumb: i18nBreadcrumbResolver, breadcrumb: i18nBreadcrumbResolver,
@@ -78,7 +78,7 @@ export const ROUTES: Route[] = [
path: 'browse/:id', path: 'browse/:id',
pathMatch: 'full', pathMatch: 'full',
component: ComcolBrowseByComponent, component: ComcolBrowseByComponent,
canActivate: [BrowseByGuard], canActivate: [browseByGuard],
resolve: { resolve: {
breadcrumb: browseByI18nBreadcrumbResolver, breadcrumb: browseByI18nBreadcrumbResolver,
}, },

View File

@@ -6,9 +6,9 @@ import {
createFailedRemoteDataObject$, createFailedRemoteDataObject$,
createSuccessfulRemoteDataObject$, createSuccessfulRemoteDataObject$,
} from '../../shared/remote-data.utils'; } from '../../shared/remote-data.utils';
import { CreateCollectionPageGuard } from './create-collection-page.guard'; import { createCollectionPageGuard } from './create-collection-page.guard';
describe('CreateCollectionPageGuard', () => { describe('createCollectionPageGuard', () => {
describe('canActivate', () => { describe('canActivate', () => {
let guard: any; let guard: any;
let router; let router;
@@ -28,7 +28,7 @@ describe('CreateCollectionPageGuard', () => {
}; };
router = new RouterMock(); router = new RouterMock();
guard = CreateCollectionPageGuard; guard = createCollectionPageGuard;
}); });
it('should return true when the parent ID resolves to a community', () => { it('should return true when the parent ID resolves to a community', () => {

View File

@@ -27,7 +27,7 @@ import {
* True when either a parent ID query parameter has been provided and the parent ID resolves to a valid parent community * True when either a parent ID query parameter has been provided and the parent ID resolves to a valid parent community
* Reroutes to a 404 page when the page cannot be activated * Reroutes to a 404 page when the page cannot be activated
*/ */
export const CreateCollectionPageGuard: CanActivateFn = ( export const createCollectionPageGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
communityService: CommunityDataService = inject(CommunityDataService), communityService: CommunityDataService = inject(CommunityDataService),

View File

@@ -3,9 +3,9 @@ import {
Route, Route,
} from '@angular/router'; } from '@angular/router';
import { BrowseByGuard } from '../browse-by/browse-by-guard'; import { browseByGuard } from '../browse-by/browse-by-guard';
import { browseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver'; import { browseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { communityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver'; import { communityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component'; import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
@@ -20,7 +20,7 @@ import {
COMMUNITY_EDIT_PATH, COMMUNITY_EDIT_PATH,
} from './community-page-routing-paths'; } from './community-page-routing-paths';
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; import { createCommunityPageGuard } from './create-community-page/create-community-page.guard';
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component'; import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-com-col-section.component';
import { ThemedCommunityPageComponent } from './themed-community-page.component'; import { ThemedCommunityPageComponent } from './themed-community-page.component';
@@ -29,7 +29,7 @@ export const ROUTES: Route[] = [
{ {
path: COMMUNITY_CREATE_PATH, path: COMMUNITY_CREATE_PATH,
component: CreateCommunityPageComponent, component: CreateCommunityPageComponent,
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard], canActivate: [authenticatedGuard, createCommunityPageGuard],
}, },
{ {
path: ':id', path: ':id',
@@ -50,7 +50,7 @@ export const ROUTES: Route[] = [
path: 'delete', path: 'delete',
pathMatch: 'full', pathMatch: 'full',
component: DeleteCommunityPageComponent, component: DeleteCommunityPageComponent,
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
}, },
{ {
path: '', path: '',
@@ -74,7 +74,7 @@ export const ROUTES: Route[] = [
path: 'browse/:id', path: 'browse/:id',
pathMatch: 'full', pathMatch: 'full',
component: ComcolBrowseByComponent, component: ComcolBrowseByComponent,
canActivate: [BrowseByGuard], canActivate: [browseByGuard],
resolve: { resolve: {
breadcrumb: browseByI18nBreadcrumbResolver, breadcrumb: browseByI18nBreadcrumbResolver,
}, },

View File

@@ -6,9 +6,9 @@ import {
createFailedRemoteDataObject$, createFailedRemoteDataObject$,
createSuccessfulRemoteDataObject$, createSuccessfulRemoteDataObject$,
} from '../../shared/remote-data.utils'; } from '../../shared/remote-data.utils';
import { CreateCommunityPageGuard } from './create-community-page.guard'; import { createCommunityPageGuard } from './create-community-page.guard';
describe('CreateCommunityPageGuard', () => { describe('createCommunityPageGuard', () => {
describe('canActivate', () => { describe('canActivate', () => {
let guard: any; let guard: any;
let router; let router;
@@ -28,7 +28,7 @@ describe('CreateCommunityPageGuard', () => {
}; };
router = new RouterMock(); router = new RouterMock();
guard = CreateCommunityPageGuard; guard = createCommunityPageGuard;
}); });
it('should return true when the parent ID resolves to a community', () => { it('should return true when the parent ID resolves to a community', () => {

View File

@@ -27,7 +27,7 @@ import {
* True when either NO parent ID query parameter has been provided, or the parent ID resolves to a valid parent community * True when either NO parent ID query parameter has been provided, or the parent ID resolves to a valid parent community
* Reroutes to a 404 page when the page cannot be activated * Reroutes to a 404 page when the page cannot be activated
*/ */
export const CreateCommunityPageGuard: CanActivateFn = ( export const createCommunityPageGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
communityService: CommunityDataService = inject(CommunityDataService), communityService: CommunityDataService = inject(CommunityDataService),

View File

@@ -17,9 +17,9 @@ import {
storeModuleConfig, storeModuleConfig,
} from '../../app.reducer'; } from '../../app.reducer';
import { authReducer } from './auth.reducer'; import { authReducer } from './auth.reducer';
import { AuthBlockingGuard } from './auth-blocking.guard'; import { authBlockingGuard } from './auth-blocking.guard';
describe('AuthBlockingGuard', () => { describe('authBlockingGuard', () => {
let guard: any; let guard: any;
let initialState; let initialState;
let store: Store<AppState>; let store: Store<AppState>;
@@ -44,7 +44,7 @@ describe('AuthBlockingGuard', () => {
], ],
providers: [ providers: [
provideMockStore({ initialState }), provideMockStore({ initialState }),
{ provide: AuthBlockingGuard, useValue: guard }, { provide: authBlockingGuard, useValue: guard },
], ],
}).compileComponents(); }).compileComponents();
})); }));
@@ -52,7 +52,7 @@ describe('AuthBlockingGuard', () => {
beforeEach(() => { beforeEach(() => {
store = TestBed.inject(Store); store = TestBed.inject(Store);
mockStore = store as MockStore<AppState>; mockStore = store as MockStore<AppState>;
guard = AuthBlockingGuard; guard = authBlockingGuard;
}); });
describe(`canActivate`, () => { describe(`canActivate`, () => {

View File

@@ -24,7 +24,7 @@ import { isAuthenticationBlocking } from './selectors';
* route until the authentication status has loaded. * route until the authentication status has loaded.
* To ensure all rest requests get the correct auth header. * To ensure all rest requests get the correct auth header.
*/ */
export const AuthBlockingGuard: CanActivateFn = ( export const authBlockingGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
store: Store<AppState> = inject(Store<AppState>), store: Store<AppState> = inject(Store<AppState>),

View File

@@ -34,7 +34,7 @@ import {
* UrlTree with redirect to login page when user isn't authenticated * UrlTree with redirect to login page when user isn't authenticated
* @method canActivate * @method canActivate
*/ */
export const AuthenticatedGuard: CanActivateFn = ( export const authenticatedGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
authService: AuthService = inject(AuthService), authService: AuthService = inject(AuthService),
@@ -61,4 +61,4 @@ export const AuthenticatedGuard: CanActivateFn = (
export const AuthenticatedGuardChild: CanActivateChildFn = ( export const AuthenticatedGuardChild: CanActivateChildFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
) => AuthenticatedGuard(route, state); ) => authenticatedGuard(route, state);

View File

@@ -1,8 +1,8 @@
import { of } from 'rxjs'; import { of } from 'rxjs';
import { NotifyInfoGuard } from './notify-info.guard'; import { notifyInfoGuard } from './notify-info.guard';
describe('NotifyInfoGuard', () => { describe('notifyInfoGuard', () => {
let guard: any; let guard: any;
let notifyInfoServiceSpy: any; let notifyInfoServiceSpy: any;
let router: any; let router: any;
@@ -10,7 +10,7 @@ describe('NotifyInfoGuard', () => {
beforeEach(() => { beforeEach(() => {
notifyInfoServiceSpy = jasmine.createSpyObj('NotifyInfoService', ['isCoarConfigEnabled']); notifyInfoServiceSpy = jasmine.createSpyObj('NotifyInfoService', ['isCoarConfigEnabled']);
router = jasmine.createSpyObj('Router', ['parseUrl']); router = jasmine.createSpyObj('Router', ['parseUrl']);
guard = NotifyInfoGuard; guard = notifyInfoGuard;
}); });
it('should be created', () => { it('should be created', () => {

View File

@@ -11,7 +11,7 @@ import { map } from 'rxjs/operators';
import { NotifyInfoService } from './notify-info.service'; import { NotifyInfoService } from './notify-info.service';
export const NotifyInfoGuard: CanActivateFn = ( export const notifyInfoGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
notifyInfoService: NotifyInfoService = inject(NotifyInfoService), notifyInfoService: NotifyInfoService = inject(NotifyInfoService),

View File

@@ -91,7 +91,7 @@ export class DsoRedirectService {
/** /**
* Redirect to a DSpaceObject's path using the given identifier type and ID. * Redirect to a DSpaceObject's path using the given identifier type and ID.
* This is used to redirect paths like "/handle/[prefix]/[suffix]" to the object's path (e.g. /items/[uuid]). * This is used to redirect paths like "/handle/[prefix]/[suffix]" to the object's path (e.g. /items/[uuid]).
* See LookupGuard for more examples. * See lookupGuard for more examples.
* *
* @param id the identifier of the object to retrieve * @param id the identifier of the object to retrieve
* @param identifierType the type of the given identifier (defaults to UUID) * @param identifierType the type of the given identifier (defaults to UUID)

View File

@@ -13,7 +13,7 @@ import { FeatureID } from '../data/feature-authorization/feature-id';
/** /**
* A guard for redirecting users to the feedback page if user is authorized * A guard for redirecting users to the feedback page if user is authorized
*/ */
export const FeedbackGuard: CanActivateFn = ( export const feedbackGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
authorizationService: AuthorizationDataService = inject(AuthorizationDataService), authorizationService: AuthorizationDataService = inject(AuthorizationDataService),

View File

@@ -2,9 +2,9 @@ import { Router } from '@angular/router';
import { AppConfig } from '../../../config/app-config.interface'; import { AppConfig } from '../../../config/app-config.interface';
import { DefaultAppConfig } from '../../../config/default-app-config'; import { DefaultAppConfig } from '../../../config/default-app-config';
import { ReloadGuard } from './reload.guard'; import { reloadGuard } from './reload.guard';
describe('ReloadGuard', () => { describe('reloadGuard', () => {
let guard: any; let guard: any;
let router: Router; let router: Router;
let appConfig: AppConfig; let appConfig: AppConfig;
@@ -12,7 +12,7 @@ describe('ReloadGuard', () => {
beforeEach(() => { beforeEach(() => {
router = jasmine.createSpyObj('router', ['parseUrl', 'createUrlTree']); router = jasmine.createSpyObj('router', ['parseUrl', 'createUrlTree']);
appConfig = new DefaultAppConfig(); appConfig = new DefaultAppConfig();
guard = ReloadGuard; guard = reloadGuard;
}); });
describe('canActivate', () => { describe('canActivate', () => {

View File

@@ -18,7 +18,7 @@ import { isNotEmpty } from '../../shared/empty.util';
* A guard redirecting the user to the URL provided in the route's query params * A guard redirecting the user to the URL provided in the route's query params
* When no redirect url is found, the user is redirected to the homepage * When no redirect url is found, the user is redirected to the homepage
*/ */
export const ReloadGuard: CanActivateFn = ( export const reloadGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
appConfig: AppConfig = inject(APP_CONFIG), appConfig: AppConfig = inject(APP_CONFIG),

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { RegistrationGuard } from '../register-page/registration.guard'; import { registrationGuard } from '../register-page/registration.guard';
import { ThemedForgotEmailComponent } from './forgot-password-email/themed-forgot-email.component'; import { ThemedForgotEmailComponent } from './forgot-password-email/themed-forgot-email.component';
import { ThemedForgotPasswordFormComponent } from './forgot-password-form/themed-forgot-password-form.component'; import { ThemedForgotPasswordFormComponent } from './forgot-password-form/themed-forgot-password-form.component';
@@ -13,6 +13,6 @@ export const ROUTES: Route[] = [
{ {
path: ':token', path: ':token',
component: ThemedForgotPasswordFormComponent, component: ThemedForgotPasswordFormComponent,
canActivate: [RegistrationGuard], canActivate: [registrationGuard],
}, },
]; ];

View File

@@ -1,11 +1,11 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { ThemedSubmissionImportExternalComponent } from '../submission/import-external/themed-submission-import-external.component'; import { ThemedSubmissionImportExternalComponent } from '../submission/import-external/themed-submission-import-external.component';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: '', path: '',
component: ThemedSubmissionImportExternalComponent, component: ThemedSubmissionImportExternalComponent,
pathMatch: 'full', pathMatch: 'full',

View File

@@ -1,6 +1,6 @@
import { environment } from '../../environments/environment'; import { environment } from '../../environments/environment';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { FeedbackGuard } from '../core/feedback/feedback.guard'; import { feedbackGuard } from '../core/feedback/feedback.guard';
import { ThemedEndUserAgreementComponent } from './end-user-agreement/themed-end-user-agreement.component'; import { ThemedEndUserAgreementComponent } from './end-user-agreement/themed-end-user-agreement.component';
import { ThemedFeedbackComponent } from './feedback/themed-feedback.component'; import { ThemedFeedbackComponent } from './feedback/themed-feedback.component';
import { import {
@@ -17,7 +17,7 @@ export const ROUTES = [
component: ThemedFeedbackComponent, component: ThemedFeedbackComponent,
resolve: { breadcrumb: i18nBreadcrumbResolver }, resolve: { breadcrumb: i18nBreadcrumbResolver },
data: { title: 'info.feedback.title', breadcrumbKey: 'info.feedback' }, data: { title: 'info.feedback.title', breadcrumbKey: 'info.feedback' },
canActivate: [FeedbackGuard], canActivate: [feedbackGuard],
}, },
environment.info.enableEndUserAgreement ? { environment.info.enableEndUserAgreement ? {
path: END_USER_AGREEMENT_PATH, path: END_USER_AGREEMENT_PATH,

View File

@@ -4,7 +4,7 @@ import {
} from '@angular/router'; } from '@angular/router';
import { REQUEST_COPY_MODULE_PATH } from '../app-routing-paths'; import { REQUEST_COPY_MODULE_PATH } from '../app-routing-paths';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { itemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver'; import { itemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver';
import { dsoEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver'; import { dsoEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model'; import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
@@ -51,7 +51,7 @@ export const ROUTES: Route[] = [
{ {
path: UPLOAD_BITSTREAM_PATH, path: UPLOAD_BITSTREAM_PATH,
component: UploadBitstreamComponent, component: UploadBitstreamComponent,
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
}, },
{ {
path: REQUEST_COPY_MODULE_PATH, path: REQUEST_COPY_MODULE_PATH,
@@ -60,7 +60,7 @@ export const ROUTES: Route[] = [
{ {
path: ORCID_PATH, path: ORCID_PATH,
component: OrcidPageComponent, component: OrcidPageComponent,
canActivate: [AuthenticatedGuard, ...mapToCanActivate([OrcidPageGuard])], canActivate: [authenticatedGuard, ...mapToCanActivate([OrcidPageGuard])],
}, },
], ],
data: { data: {

View File

@@ -1,11 +1,11 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { ThemedLogoutPageComponent } from './themed-logout-page.component'; import { ThemedLogoutPageComponent } from './themed-logout-page.component';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: '', path: '',
component: ThemedLogoutPageComponent, component: ThemedLogoutPageComponent,
data: { title: 'logout.title' }, data: { title: 'logout.title' },

View File

@@ -4,13 +4,13 @@ import {
} from '@angular/router'; } from '@angular/router';
import { isNotEmpty } from '../shared/empty.util'; import { isNotEmpty } from '../shared/empty.util';
import { LookupGuard } from './lookup-guard'; import { lookupGuard } from './lookup-guard';
import { ThemedObjectNotFoundComponent } from './objectnotfound/themed-objectnotfound.component'; import { ThemedObjectNotFoundComponent } from './objectnotfound/themed-objectnotfound.component';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
matcher: urlMatcher, matcher: urlMatcher,
canActivate: [LookupGuard], canActivate: [lookupGuard],
component: ThemedObjectNotFoundComponent, component: ThemedObjectNotFoundComponent,
}, },
]; ];

View File

@@ -1,9 +1,9 @@
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { IdentifierType } from '../core/data/request.models'; import { IdentifierType } from '../core/data/request.models';
import { LookupGuard } from './lookup-guard'; import { lookupGuard } from './lookup-guard';
describe('LookupGuard', () => { describe('lookupGuard', () => {
let dsoService: any; let dsoService: any;
let guard: any; let guard: any;
@@ -12,7 +12,7 @@ describe('LookupGuard', () => {
findByIdAndIDType: jasmine.createSpy('findByIdAndIDType').and.returnValue(observableOf({ hasFailed: false, findByIdAndIDType: jasmine.createSpy('findByIdAndIDType').and.returnValue(observableOf({ hasFailed: false,
hasSucceeded: true })), hasSucceeded: true })),
}; };
guard = LookupGuard; guard = lookupGuard;
}); });
it('should call findByIdAndIDType with handle params', () => { it('should call findByIdAndIDType with handle params', () => {

View File

@@ -17,7 +17,7 @@ interface LookupParams {
id: string; id: string;
} }
export const LookupGuard: CanActivateFn = ( export const lookupGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
dsoService: DsoRedirectService = inject(DsoRedirectService), dsoService: DsoRedirectService = inject(DsoRedirectService),

View File

@@ -1,7 +1,7 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { MyDSpaceGuard } from './my-dspace.guard'; import { myDSpaceGuard } from './my-dspace.guard';
import { ThemedMyDSpacePageComponent } from './themed-my-dspace-page.component'; import { ThemedMyDSpacePageComponent } from './themed-my-dspace-page.component';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
@@ -13,7 +13,7 @@ export const ROUTES: Route[] = [
}, },
data: { title: 'mydspace.title', breadcrumbKey: 'mydspace' }, data: { title: 'mydspace.title', breadcrumbKey: 'mydspace' },
canActivate: [ canActivate: [
MyDSpaceGuard, myDSpaceGuard,
], ],
}, },
]; ];

View File

@@ -20,7 +20,7 @@ import { MYDSPACE_ROUTE } from './my-dspace-page.component';
/** /**
* Prevent unauthorized activating and loading of mydspace configuration * Prevent unauthorized activating and loading of mydspace configuration
*/ */
export const MyDSpaceGuard: CanActivateFn = ( export const myDSpaceGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
configurationService: MyDSpaceConfigurationService = inject(MyDSpaceConfigurationService), configurationService: MyDSpaceConfigurationService = inject(MyDSpaceConfigurationService),

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ProcessDetailComponent } from './detail/process-detail.component'; import { ProcessDetailComponent } from './detail/process-detail.component';
import { NewProcessComponent } from './new/new-process.component'; import { NewProcessComponent } from './new/new-process.component';
@@ -13,7 +13,7 @@ export const ROUTES: Route[] = [
path: '', path: '',
resolve: { breadcrumb: i18nBreadcrumbResolver }, resolve: { breadcrumb: i18nBreadcrumbResolver },
data: { breadcrumbKey: 'process.overview' }, data: { breadcrumbKey: 'process.overview' },
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
children: [ children: [
{ {
path: '', path: '',

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { qualityAssuranceBreadcrumbResolver } from '../core/breadcrumbs/quality-assurance-breadcrumb.resolver'; import { qualityAssuranceBreadcrumbResolver } from '../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
import { import {
@@ -19,7 +19,7 @@ import { QualityAssuranceTopicsPageResolver } from './quality-assurance-topics-p
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${NOTIFICATIONS_RECITER_SUGGESTION_PATH}`, path: `${NOTIFICATIONS_RECITER_SUGGESTION_PATH}`,
component: NotificationsSuggestionTargetsPageComponent, component: NotificationsSuggestionTargetsPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -34,7 +34,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
component: QualityAssuranceTopicsPageComponent, component: QualityAssuranceTopicsPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -49,7 +49,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`,
component: QualityAssuranceTopicsPageComponent, component: QualityAssuranceTopicsPageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -64,7 +64,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}`, path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
component: QualityAssuranceSourcePageComponent, component: QualityAssuranceSourcePageComponent,
pathMatch: 'full', pathMatch: 'full',
@@ -80,7 +80,7 @@ export const ROUTES: Route[] = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
component: QualityAssuranceEventsPageComponent, component: QualityAssuranceEventsPageComponent,
pathMatch: 'full', pathMatch: 'full',

View File

@@ -6,7 +6,7 @@ import {
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 { ThemedCreateProfileComponent } from './create-profile/themed-create-profile.component';
import { ThemedRegisterEmailComponent } from './register-email/themed-register-email.component'; import { ThemedRegisterEmailComponent } from './register-email/themed-register-email.component';
import { RegistrationGuard } from './registration.guard'; import { registrationGuard } from './registration.guard';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
@@ -19,7 +19,7 @@ export const ROUTES: Route[] = [
path: ':token', path: ':token',
component: ThemedCreateProfileComponent, component: ThemedCreateProfileComponent,
canActivate: [ canActivate: [
RegistrationGuard, registrationGuard,
...mapToCanActivate([EndUserAgreementCookieGuard]), ...mapToCanActivate([EndUserAgreementCookieGuard]),
], ],
}, },

View File

@@ -13,9 +13,9 @@ import {
createFailedRemoteDataObject$, createFailedRemoteDataObject$,
createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject,
} from '../shared/remote-data.utils'; } from '../shared/remote-data.utils';
import { RegistrationGuard } from './registration.guard'; import { registrationGuard } from './registration.guard';
describe('RegistrationGuard', () => { describe('registrationGuard', () => {
let guard: any; let guard: any;
let epersonRegistrationService: EpersonRegistrationService; let epersonRegistrationService: EpersonRegistrationService;
@@ -65,7 +65,7 @@ describe('RegistrationGuard', () => {
setRedirectUrl: {}, setRedirectUrl: {},
}); });
guard = RegistrationGuard; guard = registrationGuard;
}); });
describe('canActivate', () => { describe('canActivate', () => {

View File

@@ -18,7 +18,7 @@ import { getFirstCompletedRemoteData } from '../core/shared/operators';
* The guard also adds the resulting RemoteData<Registration> object to the route's data for further usage in components * The guard also adds the resulting RemoteData<Registration> object to the route's data for further usage in components
* The reason this is a guard and not a resolver, is because it has to run before the EndUserAgreementCookieGuard * The reason this is a guard and not a resolver, is because it has to run before the EndUserAgreementCookieGuard
*/ */
export const RegistrationGuard: CanActivateFn = ( export const registrationGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
authService: AuthService = inject(AuthService), authService: AuthService = inject(AuthService),

View File

@@ -9,7 +9,7 @@ import {
* The format of the key will be "{configuration}.search.title" with: * The format of the key will be "{configuration}.search.title" with:
* - configuration: The current configuration stored in route.params * - configuration: The current configuration stored in route.params
*/ */
export const ConfigurationSearchPageGuard: CanActivateFn = ( export const configurationSearchPageGuard: CanActivateFn = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
state: RouterStateSnapshot, state: RouterStateSnapshot,
): boolean => { ): boolean => {

View File

@@ -1,7 +1,7 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ConfigurationSearchPageGuard } from './configuration-search-page.guard'; import { configurationSearchPageGuard } from './configuration-search-page.guard';
import { ThemedConfigurationSearchPageComponent } from './themed-configuration-search-page.component'; import { ThemedConfigurationSearchPageComponent } from './themed-configuration-search-page.component';
import { ThemedSearchPageComponent } from './themed-search-page.component'; import { ThemedSearchPageComponent } from './themed-search-page.component';
@@ -13,7 +13,7 @@ export const ROUTES: Route[] = [{
{ {
path: ':configuration', path: ':configuration',
component: ThemedConfigurationSearchPageComponent, component: ThemedConfigurationSearchPageComponent,
canActivate: [ConfigurationSearchPageGuard], canActivate: [configurationSearchPageGuard],
}, },
], ],
}]; }];

View File

@@ -1,12 +1,12 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ThemedSubmissionSubmitComponent } from '../submission/submit/themed-submission-submit.component'; import { ThemedSubmissionSubmitComponent } from '../submission/submit/themed-submission-submit.component';
export const ROUTES: Route[] = [ export const ROUTES: Route[] = [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: '', path: '',
pathMatch: 'full', pathMatch: 'full',
component: ThemedSubmissionSubmitComponent, component: ThemedSubmissionSubmitComponent,

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { publicationClaimBreadcrumbResolver } from '../core/breadcrumbs/publication-claim-breadcrumb.resolver'; import { publicationClaimBreadcrumbResolver } from '../core/breadcrumbs/publication-claim-breadcrumb.resolver';
import { SuggestionsPageComponent } from './suggestions-page.component'; import { SuggestionsPageComponent } from './suggestions-page.component';
import { suggestionsPageResolver } from './suggestions-page.resolver'; import { suggestionsPageResolver } from './suggestions-page.resolver';
@@ -17,7 +17,7 @@ export const ROUTES: Route[] = [
breadcrumbKey: 'admin.notifications.publicationclaim', breadcrumbKey: 'admin.notifications.publicationclaim',
showBreadcrumbsFluid: false, showBreadcrumbsFluid: false,
}, },
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
runGuardsAndResolvers: 'always', runGuardsAndResolvers: 'always',
component: SuggestionsPageComponent, component: SuggestionsPageComponent,
}, },

View File

@@ -1,6 +1,6 @@
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component'; import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component';
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component'; import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
@@ -23,7 +23,7 @@ export const ROUTES: Routes = [
resolve: { wfi: workflowItemPageResolver }, resolve: { wfi: workflowItemPageResolver },
children: [ children: [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: WORKFLOW_ITEM_EDIT_PATH, path: WORKFLOW_ITEM_EDIT_PATH,
component: ThemedSubmissionEditComponent, component: ThemedSubmissionEditComponent,
resolve: { resolve: {
@@ -36,7 +36,7 @@ export const ROUTES: Routes = [
}, },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: WORKFLOW_ITEM_VIEW_PATH, path: WORKFLOW_ITEM_VIEW_PATH,
component: ThemedFullItemPageComponent, component: ThemedFullItemPageComponent,
resolve: { resolve: {
@@ -46,7 +46,7 @@ export const ROUTES: Routes = [
data: { title: 'workflow-item.view.title', breadcrumbKey: 'workflow-item.view' }, data: { title: 'workflow-item.view.title', breadcrumbKey: 'workflow-item.view' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: WORKFLOW_ITEM_DELETE_PATH, path: WORKFLOW_ITEM_DELETE_PATH,
component: ThemedWorkflowItemDeleteComponent, component: ThemedWorkflowItemDeleteComponent,
resolve: { resolve: {
@@ -55,7 +55,7 @@ export const ROUTES: Routes = [
data: { title: 'workflow-item.delete.title', breadcrumbKey: 'workflow-item.edit' }, data: { title: 'workflow-item.delete.title', breadcrumbKey: 'workflow-item.edit' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: WORKFLOW_ITEM_SEND_BACK_PATH, path: WORKFLOW_ITEM_SEND_BACK_PATH,
component: ThemedWorkflowItemSendBackComponent, component: ThemedWorkflowItemSendBackComponent,
resolve: { resolve: {
@@ -64,7 +64,7 @@ export const ROUTES: Routes = [
data: { title: 'workflow-item.send-back.title', breadcrumbKey: 'workflow-item.edit' }, data: { title: 'workflow-item.send-back.title', breadcrumbKey: 'workflow-item.edit' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: ADVANCED_WORKFLOW_PATH, path: ADVANCED_WORKFLOW_PATH,
component: AdvancedWorkflowActionPageComponent, component: AdvancedWorkflowActionPageComponent,
resolve: { resolve: {

View File

@@ -1,6 +1,6 @@
import { Route } from '@angular/router'; import { Route } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { authenticatedGuard } from '../core/auth/authenticated.guard';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component'; import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component';
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component'; import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
@@ -19,7 +19,7 @@ export const ROUTES: Route[] = [
resolve: { wsi: workspaceItemPageResolver }, resolve: { wsi: workspaceItemPageResolver },
children: [ children: [
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: 'edit', path: 'edit',
component: ThemedSubmissionEditComponent, component: ThemedSubmissionEditComponent,
resolve: { resolve: {
@@ -28,7 +28,7 @@ export const ROUTES: Route[] = [
data: { title: 'submission.edit.title', breadcrumbKey: 'submission.edit' }, data: { title: 'submission.edit.title', breadcrumbKey: 'submission.edit' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: 'view', path: 'view',
component: ThemedFullItemPageComponent, component: ThemedFullItemPageComponent,
resolve: { resolve: {
@@ -38,7 +38,7 @@ export const ROUTES: Route[] = [
data: { title: 'workspace-item.view.title', breadcrumbKey: 'workspace-item.view' }, data: { title: 'workspace-item.view.title', breadcrumbKey: 'workspace-item.view' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: 'delete', path: 'delete',
component: WorkspaceItemsDeletePageComponent, component: WorkspaceItemsDeletePageComponent,
resolve: { resolve: {
@@ -48,7 +48,7 @@ export const ROUTES: Route[] = [
data: { title: 'workspace-item.delete', breadcrumbKey: 'workspace-item.delete' }, data: { title: 'workspace-item.delete', breadcrumbKey: 'workspace-item.delete' },
}, },
{ {
canActivate: [AuthenticatedGuard], canActivate: [authenticatedGuard],
path: 'delete', path: 'delete',
component: ThemedWorkspaceItemsDeletePageComponent, component: ThemedWorkspaceItemsDeletePageComponent,
resolve: { resolve: {