Skip to content

Commit 8316d8b

Browse files
committed
Merged ux-plus-2023_02_x into task/ux-plus-2023_02_x/UXP-198
2 parents 836c911 + 697a4ea commit 8316d8b

112 files changed

Lines changed: 2098 additions & 518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/config.example.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,6 @@ themes:
400400
attributes:
401401
rel: manifest
402402
href: assets/dspace/images/favicons/manifest.webmanifest
403-
- tagName: link
404-
attributes:
405-
rel: stylesheet
406-
href: "https://fonts.googleapis.com/icon?family=Material+Icons"
407403

408404
# The default bundles that should always be displayed as suggestions when you upload a new bundle
409405
bundle:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dspace-angular",
3-
"version": "2023.02.06-SNAPHOT",
3+
"version": "2023.02.07-SNAPSHOT",
44
"scripts": {
55
"ng": "ng",
66
"config:watch": "nodemon",

src/app/audit-page/object-audit-overview/object-audit-overview.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h4 class="mt-4 mb-4">{{ object.name }} (<em>{{object.type}}</em>)</h4>
6161

6262
</ng-container>
6363

64-
<h4 class="mt-4 mb-4" *ngIf="(auditsRD$ | async).statusCode === 404">{{'audit.object.overview.disabled.message' | translate}}</h4>
64+
<h4 class="mt-4 mb-4" *ngIf="(auditsRD$ | async)?.statusCode === 404">{{'audit.object.overview.disabled.message' | translate}}</h4>
6565

6666
</ng-container>
6767

src/app/audit-page/object-audit-overview/object-audit-overview.component.ts

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22

3-
import { combineLatest, Observable } from 'rxjs';
4-
import { mergeMap } from 'rxjs/operators';
3+
import { combineLatest, Observable, of, switchMap } from 'rxjs';
4+
import { map, mergeMap, take } from 'rxjs/operators';
55

66
import { RemoteData } from '../../core/data/remote-data';
77
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
@@ -18,6 +18,10 @@ import { AuthService } from '../../core/auth/auth.service';
1818
import { PaginatedList } from '../../core/data/paginated-list.model';
1919
import { PaginationService } from '../../core/pagination/pagination.service';
2020
import { redirectOn4xx } from '../../core/shared/authorized.operators';
21+
import { CollectionDataService } from '../../core/data/collection-data.service';
22+
import { Collection } from '../../core/shared/collection.model';
23+
import { Item } from '../../core/shared/item.model';
24+
import { COLLECTION_PAGE_LINKS_TO_FOLLOW } from '../../collection-page/collection-page.resolver';
2125

2226
/**
2327
* Component displaying a list of all audit about a object in a paginated table
@@ -31,7 +35,7 @@ export class ObjectAuditOverviewComponent implements OnInit {
3135
/**
3236
* The object extracted from the route.
3337
*/
34-
object;
38+
object: Item;
3539

3640
/**
3741
* List of all audits
@@ -62,14 +66,17 @@ export class ObjectAuditOverviewComponent implements OnInit {
6266
*/
6367
dateFormat = 'yyyy-MM-dd HH:mm:ss';
6468

69+
owningCollection$: Observable<Collection>;
70+
6571
constructor(protected authService: AuthService,
6672
protected route: ActivatedRoute,
6773
protected router: Router,
6874
protected auditService: AuditDataService,
6975
protected itemService: ItemDataService,
7076
protected authorizationService: AuthorizationDataService,
71-
protected paginationService: PaginationService) {
72-
}
77+
protected paginationService: PaginationService,
78+
protected collectionDataService: CollectionDataService
79+
) {}
7380

7481
ngOnInit(): void {
7582
this.route.paramMap.pipe(
@@ -78,6 +85,15 @@ export class ObjectAuditOverviewComponent implements OnInit {
7885
redirectOn4xx(this.router, this.authService)
7986
).subscribe((rd) => {
8087
this.object = rd.payload;
88+
this.owningCollection$ = this.collectionDataService.findOwningCollectionFor(
89+
this.object,
90+
true,
91+
false,
92+
...COLLECTION_PAGE_LINKS_TO_FOLLOW
93+
).pipe(
94+
getFirstCompletedRemoteData(),
95+
map(data => data?.payload)
96+
);
8197
this.setAudits();
8298
});
8399
}
@@ -88,17 +104,35 @@ export class ObjectAuditOverviewComponent implements OnInit {
88104
setAudits() {
89105
const config$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config, this.pageConfig);
90106
const isAdmin$ = this.isCurrentUserAdmin();
91-
this.auditsRD$ = combineLatest([isAdmin$, config$]).pipe(
92-
mergeMap(([isAdmin, config]) => {
107+
const parentCommunity$ = this.owningCollection$.pipe(
108+
switchMap(collection => collection.parentCommunity),
109+
getFirstCompletedRemoteData(),
110+
map(data => data?.payload)
111+
);
112+
113+
114+
this.auditsRD$ = combineLatest([isAdmin$, config$, this.owningCollection$, parentCommunity$]).pipe(
115+
mergeMap(([isAdmin, config, owningCollection, parentCommunity]) => {
93116
if (isAdmin) {
94-
return this.auditService.findByObject(this.object.id, config);
117+
return this.auditService.findByObject(this.object.id, config, owningCollection.id, parentCommunity.id);
95118
}
119+
120+
return of(null);
96121
})
97122
);
98123
}
99124

100125
isCurrentUserAdmin(): Observable<boolean> {
101-
return this.authorizationService.isAuthorized(FeatureID.AdministratorOf, undefined, undefined);
126+
return combineLatest([
127+
this.authorizationService.isAuthorized(FeatureID.IsCollectionAdmin),
128+
this.authorizationService.isAuthorized(FeatureID.IsCommunityAdmin),
129+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
130+
]).pipe(
131+
map(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin]) => {
132+
return isCollectionAdmin || isCommunityAdmin || isSiteAdmin;
133+
}),
134+
take(1),
135+
);
102136
}
103137

104138
/**

src/app/breadcrumbs/breadcrumbs.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</ng-template>
1515

1616
<ng-template #activeBreadcrumb let-text="text">
17-
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><div class="text-truncate">{{text | translate}}</div></div></li>
17+
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><span class="text-truncate" [innerHTML]="text | translate"></span></div></li>
1818
</ng-template>
1919
</ng-container>
2020

src/app/collection-page/collection-page.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ export class CollectionPageComponent implements OnInit {
119119
pagination: currentPagination,
120120
sort: currentSort,
121121
dsoTypes: [DSpaceObjectType.ITEM],
122-
forcedEmbeddedKeys: ['metrics']
122+
forcedEmbeddedKeys: ['metrics'],
123+
projection: 'preventMetadataSecurity'
123124
}), null, true, true, ...BROWSE_LINKS_TO_FOLLOW)
124125
.pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
125126
}),

src/app/core/audit/audit-data.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { SearchDataImpl } from '../data/base/search-data';
2727
import { DeleteDataImpl } from '../data/base/delete-data';
2828
import { FindAllData, FindAllDataImpl } from '../data/base/find-all-data';
2929
import { DSONameService } from '../breadcrumbs/dso-name.service';
30+
import { hasValue } from '../../shared/empty.util';
3031

3132
export const AUDIT_PERSON_NOT_AVAILABLE = 'n/a';
3233

@@ -60,12 +61,23 @@ export class AuditDataService extends IdentifiableDataService<Audit>{
6061
*
6162
* @param objectId The objectId id
6263
* @param options The [[FindListOptions]] object
64+
* @param collUuid The Uuid of the collection
65+
* @param commUuid The Uuid of the community
6366
* @return Observable<RemoteData<PaginatedList<Audit>>>
6467
*/
65-
findByObject(objectId: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Audit>>> {
68+
findByObject(objectId: string, options: FindListOptions = {}, collUuid?: string, commUuid?: string): Observable<RemoteData<PaginatedList<Audit>>> {
6669
const searchMethod = AUDIT_FIND_BY_OBJECT_SEARCH_METHOD;
70+
const searchParams = [new RequestParam('object', objectId)];
71+
72+
if (hasValue(commUuid)) {
73+
searchParams.push(new RequestParam('commUuid', commUuid));
74+
}
75+
76+
if (hasValue(collUuid)) {
77+
searchParams.push(new RequestParam('collUuid', collUuid));
78+
}
6779
const optionsWithObject = Object.assign(new FindListOptions(), options, {
68-
searchParams: [new RequestParam('object', objectId)]
80+
searchParams
6981
});
7082
return this.searchData.searchBy(searchMethod, optionsWithObject, true, true, followLink('eperson'));
7183
}

src/app/core/browse/browse-entry-search-options.model.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export class BrowseEntrySearchOptions {
1616
public sort?: SortOptions,
1717
public startsWith?: string,
1818
public scope?: string,
19-
public fetchThumbnail?: boolean) {
19+
public fetchThumbnail?: boolean,
20+
public projection?: string,
21+
) {
2022
}
2123
}

src/app/core/browse/browse.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ export class BrowseService {
148148
if (isNotEmpty(filterAuthority)) {
149149
args.push(`filterAuthority=${encodeURIComponent(filterAuthority)}`);
150150
}
151+
if (isNotEmpty(options.projection)) {
152+
args.push(`projection=${options.projection}`);
153+
}
151154
if (isNotEmpty(args)) {
152155
href = new URLCombiner(href, `?${args.join('&')}`).toString();
153156
}

src/app/core/browse/search-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export class SearchManager {
4545
* @returns {Observable<RemoteData<PaginatedList<Item>>>}
4646
*/
4747
getBrowseItemsFor(filterValue: string, filterAuthority: string, options: BrowseEntrySearchOptions, ...linksToFollow: FollowLinkConfig<any>[]): Observable<RemoteData<PaginatedList<Item>>> {
48-
return this.browseService.getBrowseItemsFor(filterValue, filterAuthority, options, ...linksToFollow)
48+
const browseOptions = Object.assign({}, options, { projection: 'preventMetadataSecurity' });
49+
return this.browseService.getBrowseItemsFor(filterValue, filterAuthority, browseOptions, ...linksToFollow)
4950
.pipe(this.completeWithExtraData());
5051
}
5152

0 commit comments

Comments
 (0)