mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'main' into DURACOM-234
# Conflicts: # src/app/core/data/request.service.ts # src/modules/app/browser-app.config.ts # src/modules/app/server-app.config.ts
This commit is contained in:
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
#CHROME_VERSION: "90.0.4430.212-1"
|
#CHROME_VERSION: "90.0.4430.212-1"
|
||||||
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
|
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
|
||||||
NODE_OPTIONS: '--max-old-space-size=4096'
|
NODE_OPTIONS: '--max-old-space-size=4096'
|
||||||
# Project name to use when running docker-compose prior to e2e tests
|
# Project name to use when running "docker compose" prior to e2e tests
|
||||||
COMPOSE_PROJECT_NAME: 'ci'
|
COMPOSE_PROJECT_NAME: 'ci'
|
||||||
strategy:
|
strategy:
|
||||||
# Create a matrix of Node versions to test against (in parallel)
|
# Create a matrix of Node versions to test against (in parallel)
|
||||||
@@ -108,12 +108,12 @@ jobs:
|
|||||||
path: 'coverage/dspace-angular/lcov.info'
|
path: 'coverage/dspace-angular/lcov.info'
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
# Using docker-compose start backend using CI configuration
|
# Using "docker compose" start backend using CI configuration
|
||||||
# and load assetstore from a cached copy
|
# and load assetstore from a cached copy
|
||||||
- name: Start DSpace REST Backend via Docker (for e2e tests)
|
- name: Start DSpace REST Backend via Docker (for e2e tests)
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f ./docker/docker-compose-ci.yml up -d
|
docker compose -f ./docker/docker-compose-ci.yml up -d
|
||||||
docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
docker compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
||||||
docker container ls
|
docker container ls
|
||||||
|
|
||||||
# Run integration tests via Cypress.io
|
# Run integration tests via Cypress.io
|
||||||
@@ -182,7 +182,7 @@ jobs:
|
|||||||
run: kill -9 $(lsof -t -i:4000)
|
run: kill -9 $(lsof -t -i:4000)
|
||||||
|
|
||||||
- name: Shutdown Docker containers
|
- name: Shutdown Docker containers
|
||||||
run: docker-compose -f ./docker/docker-compose-ci.yml down
|
run: docker compose -f ./docker/docker-compose-ci.yml down
|
||||||
|
|
||||||
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
|
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
|
||||||
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
|
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
|
||||||
|
@@ -53,6 +53,7 @@ import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
|||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { UUIDService } from '../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||||
import { ContextHelpDirective } from '../../../shared/context-help.directive';
|
import { ContextHelpDirective } from '../../../shared/context-help.directive';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
@@ -244,6 +245,7 @@ describe('GroupFormComponent', () => {
|
|||||||
{ provide: HttpClient, useValue: {} },
|
{ provide: HttpClient, useValue: {} },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
{ provide: RemoteDataBuildService, useValue: {} },
|
{ provide: RemoteDataBuildService, useValue: {} },
|
||||||
{ provide: HALEndpointService, useValue: {} },
|
{ provide: HALEndpointService, useValue: {} },
|
||||||
|
@@ -31,6 +31,7 @@ import { GroupDataService } from '../../../core/eperson/group-data.service';
|
|||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
@@ -143,6 +144,7 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: GroupDataService, useValue: groupDataService },
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -17,6 +17,7 @@ import { AuthorizationDataService } from '../../../../../core/data/feature-autho
|
|||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { XSRFService } from '../../../../../core/xsrf/xsrf.service';
|
||||||
import { AuthServiceMock } from '../../../../../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../../../../../shared/mocks/auth.service.mock';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
||||||
@@ -67,6 +68,7 @@ describe('WorkflowItemSearchResultAdminWorkflowListElementComponent', () => {
|
|||||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||||
{ provide: AuthorizationDataService, useValue: {} },
|
{ provide: AuthorizationDataService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
|
@@ -17,6 +17,7 @@ import {
|
|||||||
getTestScheduler,
|
getTestScheduler,
|
||||||
} from 'jasmine-marbles';
|
} from 'jasmine-marbles';
|
||||||
import {
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
EMPTY,
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
@@ -33,6 +34,7 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { coreReducers } from '../core.reducers';
|
import { coreReducers } from '../core.reducers';
|
||||||
import { CoreState } from '../core-state.model';
|
import { CoreState } from '../core-state.model';
|
||||||
import { UUIDService } from '../shared/uuid.service';
|
import { UUIDService } from '../shared/uuid.service';
|
||||||
|
import { XSRFService } from '../xsrf/xsrf.service';
|
||||||
import {
|
import {
|
||||||
RequestConfigureAction,
|
RequestConfigureAction,
|
||||||
RequestExecuteAction,
|
RequestExecuteAction,
|
||||||
@@ -60,6 +62,7 @@ describe('RequestService', () => {
|
|||||||
let uuidService: UUIDService;
|
let uuidService: UUIDService;
|
||||||
let store: Store<CoreState>;
|
let store: Store<CoreState>;
|
||||||
let mockStore: MockStore<CoreState>;
|
let mockStore: MockStore<CoreState>;
|
||||||
|
let xsrfService: XSRFService;
|
||||||
|
|
||||||
const testUUID = '5f2a0d2a-effa-4d54-bd54-5663b960f9eb';
|
const testUUID = '5f2a0d2a-effa-4d54-bd54-5663b960f9eb';
|
||||||
const testHref = 'https://rest.api/endpoint/selfLink';
|
const testHref = 'https://rest.api/endpoint/selfLink';
|
||||||
@@ -105,10 +108,15 @@ describe('RequestService', () => {
|
|||||||
store = TestBed.inject(Store);
|
store = TestBed.inject(Store);
|
||||||
mockStore = store as MockStore<CoreState>;
|
mockStore = store as MockStore<CoreState>;
|
||||||
mockStore.setState(initialState);
|
mockStore.setState(initialState);
|
||||||
|
xsrfService = {
|
||||||
|
tokenInitialized$: new BehaviorSubject(false),
|
||||||
|
} as XSRFService;
|
||||||
|
|
||||||
service = new RequestService(
|
service = new RequestService(
|
||||||
objectCache,
|
objectCache,
|
||||||
uuidService,
|
uuidService,
|
||||||
store,
|
store,
|
||||||
|
xsrfService,
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
serviceAsAny = service as any;
|
serviceAsAny = service as any;
|
||||||
|
@@ -43,6 +43,7 @@ import {
|
|||||||
requestIndexSelector,
|
requestIndexSelector,
|
||||||
} from '../index/index.selectors';
|
} from '../index/index.selectors';
|
||||||
import { UUIDService } from '../shared/uuid.service';
|
import { UUIDService } from '../shared/uuid.service';
|
||||||
|
import { XSRFService } from '../xsrf/xsrf.service';
|
||||||
import {
|
import {
|
||||||
RequestConfigureAction,
|
RequestConfigureAction,
|
||||||
RequestExecuteAction,
|
RequestExecuteAction,
|
||||||
@@ -169,6 +170,7 @@ export class RequestService {
|
|||||||
constructor(private objectCache: ObjectCacheService,
|
constructor(private objectCache: ObjectCacheService,
|
||||||
private uuidService: UUIDService,
|
private uuidService: UUIDService,
|
||||||
private store: Store<CoreState>,
|
private store: Store<CoreState>,
|
||||||
|
protected xsrfService: XSRFService,
|
||||||
private indexStore: Store<MetaIndexState>) {
|
private indexStore: Store<MetaIndexState>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +455,17 @@ export class RequestService {
|
|||||||
private dispatchRequest(request: RestRequest) {
|
private dispatchRequest(request: RestRequest) {
|
||||||
asapScheduler.schedule(() => {
|
asapScheduler.schedule(() => {
|
||||||
this.store.dispatch(new RequestConfigureAction(request));
|
this.store.dispatch(new RequestConfigureAction(request));
|
||||||
this.store.dispatch(new RequestExecuteAction(request.uuid));
|
// If it's a GET request, or we have an XSRF token, dispatch it immediately
|
||||||
|
if (request.method === RestRequestMethod.GET || this.xsrfService.tokenInitialized$.getValue() === true) {
|
||||||
|
this.store.dispatch(new RequestExecuteAction(request.uuid));
|
||||||
|
} else {
|
||||||
|
// Otherwise wait for the XSRF token first
|
||||||
|
this.xsrfService.tokenInitialized$.pipe(
|
||||||
|
find((hasInitialized: boolean) => hasInitialized === true),
|
||||||
|
).subscribe(() => {
|
||||||
|
this.store.dispatch(new RequestExecuteAction(request.uuid));
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
58
src/app/core/xsrf/browser-xsrf.service.spec.ts
Normal file
58
src/app/core/xsrf/browser-xsrf.service.spec.ts
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpClientTestingModule,
|
||||||
|
HttpTestingController,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
|
||||||
|
import { BrowserXSRFService } from './browser-xsrf.service';
|
||||||
|
|
||||||
|
describe(`BrowserXSRFService`, () => {
|
||||||
|
let service: BrowserXSRFService;
|
||||||
|
let httpClient: HttpClient;
|
||||||
|
let httpTestingController: HttpTestingController;
|
||||||
|
|
||||||
|
const endpointURL = new RESTURLCombiner('/security/csrf').toString();
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [ HttpClientTestingModule ],
|
||||||
|
providers: [ BrowserXSRFService ],
|
||||||
|
});
|
||||||
|
httpClient = TestBed.inject(HttpClient);
|
||||||
|
httpTestingController = TestBed.inject(HttpTestingController);
|
||||||
|
service = TestBed.inject(BrowserXSRFService);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`initXSRFToken`, () => {
|
||||||
|
it(`should perform a GET to the csrf endpoint`, (done: DoneFn) => {
|
||||||
|
service.initXSRFToken(httpClient)();
|
||||||
|
|
||||||
|
const req = httpTestingController.expectOne({
|
||||||
|
url: endpointURL,
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
|
||||||
|
req.flush({});
|
||||||
|
httpTestingController.verify();
|
||||||
|
expect().nothing();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`when the GET succeeds`, () => {
|
||||||
|
it(`should set tokenInitialized$ to true`, (done: DoneFn) => {
|
||||||
|
service.initXSRFToken(httpClient)();
|
||||||
|
|
||||||
|
const req = httpTestingController.expectOne(endpointURL);
|
||||||
|
|
||||||
|
req.flush({});
|
||||||
|
httpTestingController.verify();
|
||||||
|
|
||||||
|
expect(service.tokenInitialized$.getValue()).toBeTrue();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
30
src/app/core/xsrf/browser-xsrf.service.ts
Normal file
30
src/app/core/xsrf/browser-xsrf.service.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { take } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
|
||||||
|
import { XSRFService } from './xsrf.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browser (CSR) Service to obtain a new CSRF/XSRF token when needed by our RequestService
|
||||||
|
* to perform a modify request (e.g. POST/PUT/DELETE).
|
||||||
|
* NOTE: This is primarily necessary before the *first* modifying request, as the CSRF
|
||||||
|
* token may not yet be initialized.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class BrowserXSRFService extends XSRFService {
|
||||||
|
initXSRFToken(httpClient: HttpClient): () => Promise<any> {
|
||||||
|
return () => new Promise<void>((resolve) => {
|
||||||
|
// Force a new token to be created by calling the CSRF endpoint
|
||||||
|
httpClient.get(new RESTURLCombiner('/security/csrf').toString(), undefined).pipe(
|
||||||
|
take(1),
|
||||||
|
).subscribe(() => {
|
||||||
|
// Once token is returned, set tokenInitialized to true.
|
||||||
|
this.tokenInitialized$.next(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// return immediately, the rest of the app doesn't need to wait for this to finish
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
33
src/app/core/xsrf/server-xsrf.service.spec.ts
Normal file
33
src/app/core/xsrf/server-xsrf.service.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
import { ServerXSRFService } from './server-xsrf.service';
|
||||||
|
|
||||||
|
describe(`ServerXSRFService`, () => {
|
||||||
|
let service: ServerXSRFService;
|
||||||
|
let httpClient: HttpClient;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
httpClient = jasmine.createSpyObj(['post', 'get', 'request']);
|
||||||
|
service = new ServerXSRFService();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`initXSRFToken`, () => {
|
||||||
|
it(`shouldn't perform any requests`, (done: DoneFn) => {
|
||||||
|
service.initXSRFToken(httpClient)().then(() => {
|
||||||
|
for (const prop in httpClient) {
|
||||||
|
if (httpClient.hasOwnProperty(prop)) {
|
||||||
|
expect(httpClient[prop]).not.toHaveBeenCalled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should leave tokenInitialized$ on false`, (done: DoneFn) => {
|
||||||
|
service.initXSRFToken(httpClient)().then(() => {
|
||||||
|
expect(service.tokenInitialized$.getValue()).toBeFalse();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
19
src/app/core/xsrf/server-xsrf.service.ts
Normal file
19
src/app/core/xsrf/server-xsrf.service.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
import { XSRFService } from './xsrf.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server (SSR) Service to obtain a new CSRF/XSRF token. Because SSR only triggers GET
|
||||||
|
* requests a CSRF token is never needed.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class ServerXSRFService extends XSRFService {
|
||||||
|
initXSRFToken(httpClient: HttpClient): () => Promise<any> {
|
||||||
|
return () => new Promise<void>((resolve) => {
|
||||||
|
// return immediately, and keep tokenInitialized$ false. The server side can make only GET
|
||||||
|
// requests, since it can never get a valid XSRF cookie
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
21
src/app/core/xsrf/xsrf.service.spec.ts
Normal file
21
src/app/core/xsrf/xsrf.service.spec.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
import { XSRFService } from './xsrf.service';
|
||||||
|
|
||||||
|
class XSRFServiceImpl extends XSRFService {
|
||||||
|
initXSRFToken(httpClient: HttpClient): () => Promise<any> {
|
||||||
|
return () => null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe(`XSRFService`, () => {
|
||||||
|
let service: XSRFService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
service = new XSRFServiceImpl();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should start with tokenInitialized$.hasValue() === false`, () => {
|
||||||
|
expect(service.tokenInitialized$.getValue()).toBeFalse();
|
||||||
|
});
|
||||||
|
});
|
15
src/app/core/xsrf/xsrf.service.ts
Normal file
15
src/app/core/xsrf/xsrf.service.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract CSRF/XSRF Service used to track whether a CSRF token has been received
|
||||||
|
* from the DSpace REST API. Once it is received, the "tokenInitialized$" flag will
|
||||||
|
* be set to "true".
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export abstract class XSRFService {
|
||||||
|
public tokenInitialized$: BehaviorSubject<boolean> = new BehaviorSubject(false);
|
||||||
|
|
||||||
|
abstract initXSRFToken(httpClient: HttpClient): () => Promise<any>;
|
||||||
|
}
|
@@ -35,6 +35,7 @@ import { Bitstream } from '../../../../../core/shared/bitstream.model';
|
|||||||
import { HALEndpointService } from '../../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../../core/shared/hal-endpoint.service';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { UUIDService } from '../../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../../../core/xsrf/xsrf.service';
|
||||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||||
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
@@ -138,6 +139,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
|||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: RemoteDataBuildService, useValue: {} },
|
{ provide: RemoteDataBuildService, useValue: {} },
|
||||||
{ provide: CommunityDataService, useValue: {} },
|
{ provide: CommunityDataService, useValue: {} },
|
||||||
{ provide: HALEndpointService, useValue: {} },
|
{ provide: HALEndpointService, useValue: {} },
|
||||||
|
@@ -38,6 +38,7 @@ import { ItemType } from '../../../../core/shared/item-relationships/item-type.m
|
|||||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||||
import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
|
import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { XSRFService } from '../../../../core/xsrf/xsrf.service';
|
||||||
import { HostWindowService } from '../../../../shared/host-window.service';
|
import { HostWindowService } from '../../../../shared/host-window.service';
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
import { SelectableListService } from '../../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
@@ -257,6 +258,7 @@ describe('EditRelationshipListComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
{ provide: AuthRequestService, useValue: new AuthRequestServiceStub() },
|
{ provide: AuthRequestService, useValue: new AuthRequestServiceStub() },
|
||||||
{ provide: HardRedirectService, useValue: hardRedirectService },
|
{ provide: HardRedirectService, useValue: hardRedirectService },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||||
{ provide: REQUEST, useValue: {} },
|
{ provide: REQUEST, useValue: {} },
|
||||||
CookieService,
|
CookieService,
|
||||||
|
@@ -22,6 +22,7 @@ import {
|
|||||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||||
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
|
import { XSRFService } from '../../../../core/xsrf/xsrf.service';
|
||||||
import { MetadataFieldWrapperComponent } from '../../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
|
import { MetadataFieldWrapperComponent } from '../../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
|
||||||
import { MockBitstreamFormat1 } from '../../../../shared/mocks/item.mock';
|
import { MockBitstreamFormat1 } from '../../../../shared/mocks/item.mock';
|
||||||
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
||||||
@@ -83,6 +84,7 @@ describe('FileSectionComponent', () => {
|
|||||||
}), BrowserAnimationsModule, FileSectionComponent, VarDirective, FileSizePipe],
|
}), BrowserAnimationsModule, FileSectionComponent, VarDirective, FileSizePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: BitstreamDataService, useValue: bitstreamDataService },
|
{ provide: BitstreamDataService, useValue: bitstreamDataService },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
|
@@ -12,6 +12,7 @@ import { of as observableOf } from 'rxjs';
|
|||||||
|
|
||||||
import { APP_DATA_SERVICES_MAP } from '../../config/app-config.interface';
|
import { APP_DATA_SERVICES_MAP } from '../../config/app-config.interface';
|
||||||
import { AuthService } from '../core/auth/auth.service';
|
import { AuthService } from '../core/auth/auth.service';
|
||||||
|
import { XSRFService } from '../core/xsrf/xsrf.service';
|
||||||
import { AuthServiceMock } from '../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../shared/mocks/auth.service.mock';
|
||||||
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
|
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
|
||||||
import { LoginPageComponent } from './login-page.component';
|
import { LoginPageComponent } from './login-page.component';
|
||||||
@@ -39,6 +40,7 @@ describe('LoginPageComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
],
|
],
|
||||||
|
@@ -27,6 +27,7 @@ import {
|
|||||||
} from '../../core/auth/auth.reducer';
|
} from '../../core/auth/auth.reducer';
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model';
|
import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model';
|
||||||
|
import { XSRFService } from '../../core/xsrf/xsrf.service';
|
||||||
import { HostWindowService } from '../host-window.service';
|
import { HostWindowService } from '../host-window.service';
|
||||||
import { ActivatedRouteStub } from '../testing/active-router.stub';
|
import { ActivatedRouteStub } from '../testing/active-router.stub';
|
||||||
import { BrowserOnlyMockPipe } from '../testing/browser-only-mock.pipe';
|
import { BrowserOnlyMockPipe } from '../testing/browser-only-mock.pipe';
|
||||||
@@ -102,6 +103,7 @@ describe('AuthNavMenuComponent', () => {
|
|||||||
{ provide: HostWindowService, useValue: window },
|
{ provide: HostWindowService, useValue: window },
|
||||||
{ provide: AuthService, useValue: authService },
|
{ provide: AuthService, useValue: authService },
|
||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [
|
schemas: [
|
||||||
CUSTOM_ELEMENTS_SCHEMA,
|
CUSTOM_ELEMENTS_SCHEMA,
|
||||||
|
@@ -29,6 +29,7 @@ import {
|
|||||||
} from '../../../core/auth/auth.reducer';
|
} from '../../../core/auth/auth.reducer';
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
import { AuthTokenInfo } from '../../../core/auth/models/auth-token-info.model';
|
import { AuthTokenInfo } from '../../../core/auth/models/auth-token-info.model';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { TranslateLoaderMock } from '../../mocks/translate-loader.mock';
|
import { TranslateLoaderMock } from '../../mocks/translate-loader.mock';
|
||||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||||
import { EPersonMock } from '../../testing/eperson.mock';
|
import { EPersonMock } from '../../testing/eperson.mock';
|
||||||
@@ -91,6 +92,7 @@ describe('UserMenuComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: AuthService, useValue: authService },
|
{ provide: AuthService, useValue: authService },
|
||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [
|
schemas: [
|
||||||
|
@@ -43,6 +43,7 @@ import { FormRowModel } from '../../../../../../core/config/models/config-submis
|
|||||||
import { SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model';
|
import { SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model';
|
||||||
import { SubmissionObjectDataService } from '../../../../../../core/submission/submission-object-data.service';
|
import { SubmissionObjectDataService } from '../../../../../../core/submission/submission-object-data.service';
|
||||||
import { VocabularyService } from '../../../../../../core/submission/vocabularies/vocabulary.service';
|
import { VocabularyService } from '../../../../../../core/submission/vocabularies/vocabulary.service';
|
||||||
|
import { XSRFService } from '../../../../../../core/xsrf/xsrf.service';
|
||||||
import { SubmissionService } from '../../../../../../submission/submission.service';
|
import { SubmissionService } from '../../../../../../submission/submission.service';
|
||||||
import { createTestComponent } from '../../../../../testing/utils.test';
|
import { createTestComponent } from '../../../../../testing/utils.test';
|
||||||
import { VocabularyServiceStub } from '../../../../../testing/vocabulary-service.stub';
|
import { VocabularyServiceStub } from '../../../../../testing/vocabulary-service.stub';
|
||||||
@@ -180,6 +181,7 @@ describe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
{ provide: DsDynamicTypeBindRelationService, useClass: DsDynamicTypeBindRelationService },
|
{ provide: DsDynamicTypeBindRelationService, useClass: DsDynamicTypeBindRelationService },
|
||||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||||
{ provide: SubmissionService, useValue: {} },
|
{ provide: SubmissionService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
||||||
|
@@ -33,6 +33,7 @@ import { ExternalSource } from '../../../../../core/shared/external-source.model
|
|||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service';
|
||||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
||||||
|
import { XSRFService } from '../../../../../core/xsrf/xsrf.service';
|
||||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||||
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||||
@@ -147,6 +148,7 @@ describe('DsDynamicLookupRelationModalComponent', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: NgZone, useValue: new NgZone({}) },
|
{ provide: NgZone, useValue: new NgZone({}) },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
|
@@ -33,6 +33,7 @@ import { BehaviorSubject } from 'rxjs';
|
|||||||
|
|
||||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||||
import { storeModuleConfig } from '../../app.reducer';
|
import { storeModuleConfig } from '../../app.reducer';
|
||||||
|
import { XSRFService } from '../../core/xsrf/xsrf.service';
|
||||||
import { StoreMock } from '../testing/store.mock';
|
import { StoreMock } from '../testing/store.mock';
|
||||||
import { createTestComponent } from '../testing/utils.test';
|
import { createTestComponent } from '../testing/utils.test';
|
||||||
import { DsDynamicFormComponent } from './builder/ds-dynamic-form-ui/ds-dynamic-form.component';
|
import { DsDynamicFormComponent } from './builder/ds-dynamic-form-ui/ds-dynamic-form.component';
|
||||||
@@ -176,6 +177,7 @@ describe('FormComponent test suite', () => {
|
|||||||
FormComponent,
|
FormComponent,
|
||||||
FormService,
|
FormService,
|
||||||
{ provide: Store, useClass: StoreMock },
|
{ provide: Store, useClass: StoreMock },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
})
|
})
|
||||||
|
@@ -18,6 +18,7 @@ import { of } from 'rxjs';
|
|||||||
import { AuthRequestService } from 'src/app/core/auth/auth-request.service';
|
import { AuthRequestService } from 'src/app/core/auth/auth-request.service';
|
||||||
import { CookieService } from 'src/app/core/services/cookie.service';
|
import { CookieService } from 'src/app/core/services/cookie.service';
|
||||||
import { HardRedirectService } from 'src/app/core/services/hard-redirect.service';
|
import { HardRedirectService } from 'src/app/core/services/hard-redirect.service';
|
||||||
|
import { XSRFService } from 'src/app/core/xsrf/xsrf.service';
|
||||||
import { CookieServiceMock } from 'src/app/shared/mocks/cookie.service.mock';
|
import { CookieServiceMock } from 'src/app/shared/mocks/cookie.service.mock';
|
||||||
import { getMockThemeService } from 'src/app/shared/mocks/theme-service.mock';
|
import { getMockThemeService } from 'src/app/shared/mocks/theme-service.mock';
|
||||||
import { AuthRequestServiceStub } from 'src/app/shared/testing/auth-request-service.stub';
|
import { AuthRequestServiceStub } from 'src/app/shared/testing/auth-request-service.stub';
|
||||||
@@ -70,6 +71,7 @@ describe('ListableObjectComponentLoaderComponent', () => {
|
|||||||
{ provide: HardRedirectService, useValue: jasmine.createSpyObj('hardRedirectService', ['redirect']) },
|
{ provide: HardRedirectService, useValue: jasmine.createSpyObj('hardRedirectService', ['redirect']) },
|
||||||
{ provide: AuthRequestService, useValue: new AuthRequestServiceStub() },
|
{ provide: AuthRequestService, useValue: new AuthRequestServiceStub() },
|
||||||
{ provide: CookieService, useValue: new CookieServiceMock() },
|
{ provide: CookieService, useValue: new CookieServiceMock() },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: REQUEST, useValue: {} },
|
{ provide: REQUEST, useValue: {} },
|
||||||
{
|
{
|
||||||
provide: ActivatedRoute,
|
provide: ActivatedRoute,
|
||||||
|
@@ -32,6 +32,7 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { SearchService } from '../../../../core/shared/search/search.service';
|
import { SearchService } from '../../../../core/shared/search/search.service';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../../core/xsrf/xsrf.service';
|
||||||
import { AuthServiceMock } from '../../../../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../../../../shared/mocks/auth.service.mock';
|
||||||
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
||||||
import { SearchServiceStub } from '../../../../shared/testing/search-service.stub';
|
import { SearchServiceStub } from '../../../../shared/testing/search-service.stub';
|
||||||
@@ -114,6 +115,7 @@ describe('ItemDetailPreviewComponent', () => {
|
|||||||
{ provide: HALEndpointService, useValue: new HALEndpointServiceStub('workspaceitems') },
|
{ provide: HALEndpointService, useValue: new HALEndpointServiceStub('workspaceitems') },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
{ provide: RemoteDataBuildService, useValue: {} },
|
{ provide: RemoteDataBuildService, useValue: {} },
|
||||||
{ provide: CommunityDataService, useValue: {} },
|
{ provide: CommunityDataService, useValue: {} },
|
||||||
|
@@ -26,6 +26,7 @@ import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.ser
|
|||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../../core/xsrf/xsrf.service';
|
||||||
import { NotificationsService } from '../../../notifications/notifications.service';
|
import { NotificationsService } from '../../../notifications/notifications.service';
|
||||||
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
||||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||||
@@ -95,6 +96,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
|||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
],
|
],
|
||||||
|
@@ -26,6 +26,7 @@ import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.ser
|
|||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../../core/xsrf/xsrf.service';
|
||||||
import { AuthServiceMock } from '../../../../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../../../../shared/mocks/auth.service.mock';
|
||||||
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
||||||
import { StoreMock } from '../../../../shared/testing/store.mock';
|
import { StoreMock } from '../../../../shared/testing/store.mock';
|
||||||
@@ -100,6 +101,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).overrideComponent(CommunitySearchResultGridElementComponent, {
|
}).overrideComponent(CommunitySearchResultGridElementComponent, {
|
||||||
|
@@ -17,6 +17,7 @@ import { AuthService } from '../../../../../core/auth/auth.service';
|
|||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { AuthorizationDataService } from '../../../../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
|
import { XSRFService } from '../../../../../core/xsrf/xsrf.service';
|
||||||
import { AuthServiceMock } from '../../../../../shared/mocks/auth.service.mock';
|
import { AuthServiceMock } from '../../../../../shared/mocks/auth.service.mock';
|
||||||
import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service';
|
import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service';
|
||||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||||
@@ -78,6 +79,7 @@ describe('ItemListElementComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||||
{ provide: AuthorizationDataService, useValue: {} },
|
{ provide: AuthorizationDataService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).overrideComponent(ItemListElementComponent, {
|
}).overrideComponent(ItemListElementComponent, {
|
||||||
|
@@ -46,6 +46,7 @@ import {
|
|||||||
SearchConfig,
|
SearchConfig,
|
||||||
SortConfig,
|
SortConfig,
|
||||||
} from '../../core/shared/search/search-filters/search-config.model';
|
} from '../../core/shared/search/search-filters/search-config.model';
|
||||||
|
import { XSRFService } from '../../core/xsrf/xsrf.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-configuration.service';
|
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { HostWindowService } from '../host-window.service';
|
import { HostWindowService } from '../host-window.service';
|
||||||
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
||||||
@@ -237,6 +238,7 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
|
|||||||
provide: SearchFilterService,
|
provide: SearchFilterService,
|
||||||
useValue: {},
|
useValue: {},
|
||||||
},
|
},
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useValue: searchConfigurationServiceStub,
|
useValue: searchConfigurationServiceStub,
|
||||||
|
@@ -22,6 +22,7 @@ import { AuthService } from '../../core/auth/auth.service';
|
|||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
import { ItemDataService } from '../../core/data/item-data.service';
|
||||||
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||||
import { SubmissionJsonPatchOperationsService } from '../../core/submission/submission-json-patch-operations.service';
|
import { SubmissionJsonPatchOperationsService } from '../../core/submission/submission-json-patch-operations.service';
|
||||||
|
import { XSRFService } from '../../core/xsrf/xsrf.service';
|
||||||
import { mockSubmissionObject } from '../../shared/mocks/submission.mock';
|
import { mockSubmissionObject } from '../../shared/mocks/submission.mock';
|
||||||
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
@@ -83,6 +84,7 @@ describe('SubmissionEditComponent Component', () => {
|
|||||||
{ provide: HALEndpointService, useValue: halService },
|
{ provide: HALEndpointService, useValue: halService },
|
||||||
{ provide: SectionsService, useValue: new SectionsServiceStub() },
|
{ provide: SectionsService, useValue: new SectionsServiceStub() },
|
||||||
{ provide: ThemeService, useValue: themeService },
|
{ provide: ThemeService, useValue: themeService },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
provideMockStore(),
|
provideMockStore(),
|
||||||
],
|
],
|
||||||
|
@@ -24,6 +24,7 @@ import { SubmissionAccessesConfigDataService } from '../../../core/config/submis
|
|||||||
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||||
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
||||||
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { dsDynamicFormControlMapFn } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
import { dsDynamicFormControlMapFn } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||||
import { DsDynamicTypeBindRelationService } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
import { DsDynamicTypeBindRelationService } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
@@ -120,6 +121,7 @@ describe('SubmissionSectionAccessesComponent', () => {
|
|||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||||
{ provide: SubmissionService, useValue: {} },
|
{ provide: SubmissionService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
||||||
@@ -216,6 +218,7 @@ describe('SubmissionSectionAccessesComponent', () => {
|
|||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||||
{ provide: SubmissionService, useValue: {} },
|
{ provide: SubmissionService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },
|
||||||
|
@@ -38,6 +38,7 @@ import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/jso
|
|||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { License } from '../../../core/shared/license.model';
|
import { License } from '../../../core/shared/license.model';
|
||||||
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { dsDynamicFormControlMapFn } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
import { dsDynamicFormControlMapFn } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||||
@@ -191,6 +192,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
|||||||
findById: () => observableOf(createSuccessfulRemoteDataObject(mockSubmissionObject)),
|
findById: () => observableOf(createSuccessfulRemoteDataObject(mockSubmissionObject)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
SubmissionSectionLicenseComponent,
|
SubmissionSectionLicenseComponent,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
@@ -38,6 +38,7 @@ import { environment } from '../../../../../../environments/environment.test';
|
|||||||
import { JsonPatchOperationPathCombiner } from '../../../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
import { JsonPatchOperationPathCombiner } from '../../../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||||
import { JsonPatchOperationsBuilder } from '../../../../../core/json-patch/builder/json-patch-operations-builder';
|
import { JsonPatchOperationsBuilder } from '../../../../../core/json-patch/builder/json-patch-operations-builder';
|
||||||
import { SubmissionJsonPatchOperationsService } from '../../../../../core/submission/submission-json-patch-operations.service';
|
import { SubmissionJsonPatchOperationsService } from '../../../../../core/submission/submission-json-patch-operations.service';
|
||||||
|
import { XSRFService } from '../../../../../core/xsrf/xsrf.service';
|
||||||
import { dateToISOFormat } from '../../../../../shared/date.util';
|
import { dateToISOFormat } from '../../../../../shared/date.util';
|
||||||
import { DsDynamicTypeBindRelationService } from '../../../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
import { DsDynamicTypeBindRelationService } from '../../../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||||
import { DynamicCustomSwitchModel } from '../../../../../shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.model';
|
import { DynamicCustomSwitchModel } from '../../../../../shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.model';
|
||||||
@@ -154,6 +155,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents().then();
|
}).compileComponents().then();
|
||||||
|
@@ -311,6 +311,14 @@ describe('SystemWideAlertFormComponent', () => {
|
|||||||
expect(comp.back).not.toHaveBeenCalled();
|
expect(comp.back).not.toHaveBeenCalled();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
it('should not create the new alert when the enable button is clicked on an invalid the form', () => {
|
||||||
|
spyOn(comp as any, 'handleResponse');
|
||||||
|
|
||||||
|
comp.formMessage.patchValue('');
|
||||||
|
comp.save();
|
||||||
|
|
||||||
|
expect((comp as any).handleResponse).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('back', () => {
|
describe('back', () => {
|
||||||
it('should navigate back to the home page', () => {
|
it('should navigate back to the home page', () => {
|
||||||
|
@@ -256,11 +256,13 @@ export class SystemWideAlertFormComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
alert.countdownTo = null;
|
alert.countdownTo = null;
|
||||||
}
|
}
|
||||||
if (hasValue(this.currentAlert)) {
|
if (this.alertForm.valid) {
|
||||||
const updatedAlert = Object.assign(new SystemWideAlert(), this.currentAlert, alert);
|
if (hasValue(this.currentAlert)) {
|
||||||
this.handleResponse(this.systemWideAlertDataService.put(updatedAlert), 'system-wide-alert.form.update', navigateToHomePage);
|
const updatedAlert = Object.assign(new SystemWideAlert(), this.currentAlert, alert);
|
||||||
} else {
|
this.handleResponse(this.systemWideAlertDataService.put(updatedAlert), 'system-wide-alert.form.update', navigateToHomePage);
|
||||||
this.handleResponse(this.systemWideAlertDataService.create(alert), 'system-wide-alert.form.create', navigateToHomePage);
|
} else {
|
||||||
|
this.handleResponse(this.systemWideAlertDataService.create(alert), 'system-wide-alert.form.create', navigateToHomePage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,6 +3,10 @@ import {
|
|||||||
provideHttpClient,
|
provideHttpClient,
|
||||||
withInterceptorsFromDi,
|
withInterceptorsFromDi,
|
||||||
} from '@angular/common/http';
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
APP_INITIALIZER,
|
||||||
|
NgModule,
|
||||||
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
APP_ID,
|
APP_ID,
|
||||||
ApplicationConfig,
|
ApplicationConfig,
|
||||||
@@ -49,6 +53,8 @@ import { ClientCookieService } from '../../app/core/services/client-cookie.servi
|
|||||||
import { CookieService } from '../../app/core/services/cookie.service';
|
import { CookieService } from '../../app/core/services/cookie.service';
|
||||||
import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
|
import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
|
||||||
import { ReferrerService } from '../../app/core/services/referrer.service';
|
import { ReferrerService } from '../../app/core/services/referrer.service';
|
||||||
|
import { BrowserXSRFService } from '../../app/core/xsrf/browser-xsrf.service';
|
||||||
|
import { XSRFService } from '../../app/core/xsrf/xsrf.service';
|
||||||
import { ClientMathService } from '../../app/core/shared/client-math.service';
|
import { ClientMathService } from '../../app/core/shared/client-math.service';
|
||||||
import { MathService } from '../../app/core/shared/math.service';
|
import { MathService } from '../../app/core/shared/math.service';
|
||||||
import { BrowserKlaroService } from '../../app/shared/cookies/browser-klaro.service';
|
import { BrowserKlaroService } from '../../app/shared/cookies/browser-klaro.service';
|
||||||
@@ -96,6 +102,16 @@ export const browserAppConfig: ApplicationConfig = mergeApplicationConfig({
|
|||||||
useFactory: getRequest,
|
useFactory: getRequest,
|
||||||
deps: [TransferState],
|
deps: [TransferState],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: APP_INITIALIZER,
|
||||||
|
useFactory: (xsrfService: XSRFService, httpClient: HttpClient) => xsrfService.initXSRFToken(httpClient),
|
||||||
|
deps: [ XSRFService, HttpClient ],
|
||||||
|
multi: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: XSRFService,
|
||||||
|
useClass: BrowserXSRFService,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provide: AuthService,
|
provide: AuthService,
|
||||||
useClass: AuthService,
|
useClass: AuthService,
|
||||||
|
@@ -50,6 +50,8 @@ import { ServerHardRedirectService } from '../../app/core/services/server-hard-r
|
|||||||
import { ServerXhrService } from '../../app/core/services/server-xhr.service';
|
import { ServerXhrService } from '../../app/core/services/server-xhr.service';
|
||||||
import { MathService } from '../../app/core/shared/math.service';
|
import { MathService } from '../../app/core/shared/math.service';
|
||||||
import { ServerMathService } from '../../app/core/shared/server-math.service';
|
import { ServerMathService } from '../../app/core/shared/server-math.service';
|
||||||
|
import { ServerXSRFService } from '../../app/core/xsrf/server-xsrf.service';
|
||||||
|
import { XSRFService } from '../../app/core/xsrf/xsrf.service';
|
||||||
import { AngularticsProviderMock } from '../../app/shared/mocks/angulartics-provider.service.mock';
|
import { AngularticsProviderMock } from '../../app/shared/mocks/angulartics-provider.service.mock';
|
||||||
import { Angulartics2Mock } from '../../app/shared/mocks/angulartics2.service.mock';
|
import { Angulartics2Mock } from '../../app/shared/mocks/angulartics2.service.mock';
|
||||||
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
|
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
|
||||||
@@ -112,6 +114,10 @@ export const serverAppConfig: ApplicationConfig = mergeApplicationConfig({
|
|||||||
provide: AuthRequestService,
|
provide: AuthRequestService,
|
||||||
useClass: ServerAuthRequestService,
|
useClass: ServerAuthRequestService,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: XSRFService,
|
||||||
|
useClass: ServerXSRFService,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provide: LocaleService,
|
provide: LocaleService,
|
||||||
useClass: ServerLocaleService,
|
useClass: ServerLocaleService,
|
||||||
|
Reference in New Issue
Block a user