Skip to content

Commit a704ea6

Browse files
vins01-4scienceAndrea Barbasso
authored andcommitted
Merged in task/dspace-cris-2025_02_x/DSC-2699 (pull request DSpace#4051)
DSC-2699 Approved-by: Andrea Barbasso
2 parents 405c632 + 7048113 commit a704ea6

File tree

8 files changed

+357
-69
lines changed

8 files changed

+357
-69
lines changed

src/app/core/data/feature-authorization/feature-id.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum FeatureID {
1313
CanManageGroup = 'canManageGroup',
1414
IsCollectionAdmin = 'isCollectionAdmin',
1515
IsCommunityAdmin = 'isCommunityAdmin',
16+
IsComColAdmin = 'isComColAdmin',
1617
CanChangePassword = 'canChangePassword',
1718
CanDownload = 'canDownload',
1819
CanRequestACopy = 'canRequestACopy',

src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
9696

9797
ngOnInit(): void {
9898
this.allOptions$ = this.calculateBrowseProperty().pipe(
99-
switchMap ( (browseProperty) => this.configurationService.findByPropertyName( browseProperty) ),
99+
switchMap((browseProperty) => this.configurationService.findByPropertyName(browseProperty)),
100100
getFinishedRemoteData(),
101-
switchMap( (remoteData) => this.searchForBaseBrowseCollectionPropertyIfDataNotFound(remoteData)),
101+
switchMap((remoteData) => this.searchForBaseBrowseCollectionPropertyIfDataNotFound(remoteData)),
102102
getFinishedRemoteData(),
103103
getRemoteDataPayload(),
104-
map ( (configProperty) => {
104+
map((configProperty) => {
105105
const comColRoute = (this.contentType === 'collection') ? getCollectionPageRoute(this.id) : getCommunityPageRoute(this.id);
106106
let options = this.initOptionsByContentType(comColRoute);
107107
if (configProperty) {
@@ -132,14 +132,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
132132
this.allOptions$,
133133
this.router.events.pipe(
134134
startWith(this.router),
135-
filter((next: Router|Scroll) => (isNotEmpty((next as Router)?.url) || (next as Scroll)?.type === EventType.Scroll)),
136-
map((next: Router|Scroll) => (next as Router)?.url || ((next as Scroll).routerEvent as NavigationEnd).urlAfterRedirects),
135+
filter((next: Router | Scroll) => (isNotEmpty((next as Router)?.url) || (next as Scroll)?.type === EventType.Scroll)),
136+
map((next: Router | Scroll) => (next as Router)?.url || ((next as Scroll).routerEvent as NavigationEnd).urlAfterRedirects),
137137
distinctUntilChanged(),
138138
),
139139
]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => {
140140
for (const option of navOptions) {
141141
if (url?.split('?')[0] === comColRoute && option.id === this.appConfig[this.contentType].defaultBrowseTab) {
142-
void this.router.navigate([option.routerLink], { queryParams: option.params, replaceUrl: true });
142+
void this.router.navigate([option.routerLink], { queryParams: option.params, replaceUrl: true });
143143
break;
144144
} else if (option.routerLink === url?.split('?')[0]) {
145145
this.currentOptionId$.next(option.id);
@@ -154,7 +154,7 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
154154
).subscribe((allOptions: ComColPageNavOption[]) => {
155155
for (const option of allOptions) {
156156
if (option.id === this.appConfig[this.contentType].defaultBrowseTab) {
157-
this.currentOptionId$.next(option[0].id);
157+
this.currentOptionId$.next(option.id);
158158
void this.router.navigate([option.routerLink], { queryParams: option.params });
159159
break;
160160
}
@@ -181,8 +181,8 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
181181
if (this.contentType === 'collection') {
182182
return this.collectionService.findById(this.id).pipe(
183183
getFirstSucceededRemoteDataPayload(),
184-
map( (collection) => collection.firstMetadataValue('dspace.entity.type') ),
185-
map ( (entityType) => entityType ? 'browse.collection.' + entityType : 'browse.collection' ),
184+
map((collection) => collection.firstMetadataValue('dspace.entity.type')),
185+
map((entityType) => entityType ? 'browse.collection.' + entityType : 'browse.collection'),
186186
);
187187
}
188188
return of('browse.' + this.contentType);

src/app/shared/menu/providers/admin-search.menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class AdminSearchMenuProvider extends AbstractMenuProvider {
3232
}
3333

3434
public getSections(): Observable<PartialMenuSection[]> {
35-
return this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe(
35+
return this.authorizationService.isAuthorized(FeatureID.IsComColAdmin).pipe(
3636
map((isSiteAdmin) => {
3737
return [
3838
{

src/app/shared/menu/providers/export.menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class ExportMenuProvider extends AbstractExpandableMenuProvider {
5757

5858
public getSubSections(): Observable<PartialMenuSection[]> {
5959
return observableCombineLatest([
60-
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
60+
this.authorizationService.isAuthorized(FeatureID.IsComColAdmin),
6161
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME),
6262
]).pipe(
6363
map(([authorized, metadataExportScriptExists]: [boolean, boolean]) => {

src/app/shared/menu/providers/import.menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class ImportMenuProvider extends AbstractExpandableMenuProvider {
5353

5454
public getSubSections(): Observable<PartialMenuSection[]> {
5555
return observableCombineLatest([
56-
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
56+
this.authorizationService.isAuthorized(FeatureID.IsComColAdmin),
5757
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME),
5858
]).pipe(
5959
map(([authorized, metadataImportScriptExists]) => {

0 commit comments

Comments
 (0)