Skip to content

Commit ed9570e

Browse files
committed
Merge remote-tracking branch 'origin/main' into w2p-92900_Admin_options_dont_appear_after_Shibboleth_authentication_PR
2 parents f154318 + c1f6993 commit ed9570e

39 files changed

Lines changed: 8395 additions & 99 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ If needing to update default configurations values for production, update local
179179

180180
- Update `environment.production.ts` file in `src/environment/` for a `production` environment;
181181

182-
The environment object is provided for use as import in code and is extended with he runtime configuration on bootstrap of the application.
182+
The environment object is provided for use as import in code and is extended with the runtime configuration on bootstrap of the application.
183183

184184
> Take caution moving runtime configs into the buildtime configuration. They will be overwritten by what is defined in the runtime config on bootstrap.
185185

config/config.example.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ languages:
150150
- code: fi
151151
label: Suomi
152152
active: true
153+
- code: sv
154+
label: Svenska
155+
active: true
153156
- code: tr
154157
label: Türkçe
155158
active: true
@@ -248,3 +251,10 @@ bundle:
248251
mediaViewer:
249252
image: false
250253
video: false
254+
255+
# Whether the end user agreement is required before users use the repository.
256+
# If enabled, the user will be required to accept the agreement before they can use the repository.
257+
# And whether the privacy statement should exist or not.
258+
info:
259+
enableEndUserAgreement: true
260+
enablePrivacyStatement: true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"mirador": "^3.3.0",
108108
"mirador-dl-plugin": "^0.13.0",
109109
"mirador-share-plugin": "^0.11.0",
110-
"moment": "^2.29.2",
110+
"moment": "^2.29.4",
111111
"morgan": "^1.10.0",
112112
"ng-mocks": "^13.1.1",
113113
"ng2-file-upload": "1.4.0",

src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-
1818
import { PaginationService } from '../../core/pagination/pagination.service';
1919
import { map } from 'rxjs/operators';
2020

21+
export const BBM_PAGINATION_ID = 'bbm';
22+
2123
@Component({
2224
selector: 'ds-browse-by-metadata-page',
2325
styleUrls: ['./browse-by-metadata-page.component.scss'],
@@ -50,7 +52,7 @@ export class BrowseByMetadataPageComponent implements OnInit {
5052
* The pagination config used to display the values
5153
*/
5254
paginationConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
53-
id: 'bbm',
55+
id: BBM_PAGINATION_ID,
5456
currentPage: 1,
5557
pageSize: 20
5658
});

src/app/core/data/feature-authorization/feature-authorization-guard/some-feature-authorization.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export abstract class SomeFeatureAuthorizationGuard implements CanActivate {
1919

2020
/**
2121
* True when user has authorization rights for the feature and object provided
22-
* Redirect the user to the unauthorized page when he/she's not authorized for the given feature
22+
* Redirect the user to the unauthorized page when they are not authorized for the given feature
2323
*/
2424
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
2525
return observableCombineLatest(this.getFeatureIDs(route, state), this.getObjectUrl(route, state), this.getEPersonUuid(route, state)).pipe(

src/app/core/data/processes/process-data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ProcessDataService extends DataService<Process> {
3838
}
3939

4040
/**
41-
* Get the endpoint for a process his files
41+
* Get the endpoint for the files of the process
4242
* @param processId The ID of the process
4343
*/
4444
getFilesEndpoint(processId: string): Observable<string> {

src/app/core/end-user-agreement/abstract-end-user-agreement.guard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
2-
import { Observable } from 'rxjs';
2+
import { Observable, of as observableOf } from 'rxjs';
33
import { returnEndUserAgreementUrlTreeOnFalse } from '../shared/authorized.operators';
4+
import { environment } from '../../../environments/environment';
45

56
/**
67
* An abstract guard for redirecting users to the user agreement page if a certain condition is met
@@ -18,6 +19,9 @@ export abstract class AbstractEndUserAgreementGuard implements CanActivate {
1819
* when they're finished accepting the agreement
1920
*/
2021
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
22+
if (!environment.info.enableEndUserAgreement) {
23+
return observableOf(true);
24+
}
2125
return this.hasAccepted().pipe(
2226
returnEndUserAgreementUrlTreeOnFalse(this.router, state.url)
2327
);

src/app/core/end-user-agreement/end-user-agreement-current-user.guard.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { EndUserAgreementCurrentUserGuard } from './end-user-agreement-current-u
22
import { EndUserAgreementService } from './end-user-agreement.service';
33
import { Router, UrlTree } from '@angular/router';
44
import { of as observableOf } from 'rxjs';
5+
import { environment } from '../../../environments/environment.test';
56

67
describe('EndUserAgreementGuard', () => {
78
let guard: EndUserAgreementCurrentUserGuard;
@@ -44,5 +45,24 @@ describe('EndUserAgreementGuard', () => {
4445
});
4546
});
4647
});
48+
49+
describe('when the end user agreement is disabled', () => {
50+
it('should return true', (done) => {
51+
environment.info.enableEndUserAgreement = false;
52+
guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => {
53+
console.log(result);
54+
expect(result).toEqual(true);
55+
done();
56+
});
57+
});
58+
59+
it('should not resolve to the end user agreement page', (done) => {
60+
environment.info.enableEndUserAgreement = false;
61+
guard.canActivate(undefined, Object.assign({ url: 'redirect' })).subscribe((result) => {
62+
expect(router.navigateByUrl).not.toHaveBeenCalled();
63+
done();
64+
});
65+
});
66+
});
4767
});
4868
});

src/app/core/end-user-agreement/end-user-agreement-current-user.guard.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Injectable } from '@angular/core';
2-
import { Observable } from 'rxjs';
2+
import { Observable, of as observableOf } from 'rxjs';
33
import { AbstractEndUserAgreementGuard } from './abstract-end-user-agreement.guard';
44
import { EndUserAgreementService } from './end-user-agreement.service';
55
import { Router } from '@angular/router';
6+
import { environment } from '../../../environments/environment';
67

78
/**
89
* A guard redirecting logged in users to the end agreement page when they haven't accepted the latest user agreement
@@ -19,6 +20,10 @@ export class EndUserAgreementCurrentUserGuard extends AbstractEndUserAgreementGu
1920
* True when the currently logged in user has accepted the agreements or when the user is not currently authenticated
2021
*/
2122
hasAccepted(): Observable<boolean> {
23+
if (!environment.info.enableEndUserAgreement) {
24+
return observableOf(true);
25+
}
26+
2227
return this.endUserAgreementService.hasCurrentUserAcceptedAgreement(true);
2328
}
2429

src/app/core/end-user-agreement/end-user-agreement.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class EndUserAgreementService {
5555

5656
/**
5757
* Set the current user's accepted agreement status
58-
* When a user is authenticated, set his/her metadata to the provided value
58+
* When a user is authenticated, set their metadata to the provided value
5959
* When no user is authenticated, set the cookie to the provided value
6060
* @param accepted
6161
*/

0 commit comments

Comments
 (0)