diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4a912c..2ad33f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel - Datasets: Added `exportDatasetMetadata` use case, repository method, and `ExportedDatasetMetadata` response type to support exporting dataset metadata by numeric id or persistent id through Dataverse endpoint `GET /datasets/export`. - Collections: Added `allowedDatasetTypes` field to the [Collection](./src/collections/domain/models/Collection.ts) model. This field is optional and only populated the feature is enabled on the installation and configured on the collection. - Collections: Added theme information when retrieving a collection using `getCollection`. +- Collections: Added optional `ignoreSettingExcludeEmailFromExport` support to `getCollection`. ### Changed diff --git a/src/collections/domain/repositories/ICollectionsRepository.ts b/src/collections/domain/repositories/ICollectionsRepository.ts index ed6cf4ff..03a5fff9 100644 --- a/src/collections/domain/repositories/ICollectionsRepository.ts +++ b/src/collections/domain/repositories/ICollectionsRepository.ts @@ -16,7 +16,10 @@ import { StorageDriver } from '../../../core/domain/models/StorageDriver' import { LinkingObjectType } from '../useCases/GetCollectionsForLinking' export interface ICollectionsRepository { - getCollection(collectionIdOrAlias: number | string): Promise + getCollection( + collectionIdOrAlias: number | string, + ignoreSettingExcludeEmailFromExport?: boolean + ): Promise getCollectionStorageDriver( collectionIdOrAlias: number | string, getEffective?: boolean diff --git a/src/collections/domain/useCases/GetCollection.ts b/src/collections/domain/useCases/GetCollection.ts index 38f1d6d6..13338400 100644 --- a/src/collections/domain/useCases/GetCollection.ts +++ b/src/collections/domain/useCases/GetCollection.ts @@ -14,9 +14,16 @@ export class GetCollection implements UseCase { * * @param {number | string} [collectionIdOrAlias = ':root'] - A generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId) * If this parameter is not set, the default value is: ':root' + * @param {boolean} ignoreSettingExcludeEmailFromExport - This prevents the contact emails from being excluded when the setting `ExcludeEmailFromExport` is set to true and the user has EditDataverse permissions. * @returns {Promise} */ - async execute(collectionIdOrAlias: number | string = ROOT_COLLECTION_ID): Promise { - return await this.collectionsRepository.getCollection(collectionIdOrAlias) + async execute( + collectionIdOrAlias: number | string = ROOT_COLLECTION_ID, + ignoreSettingExcludeEmailFromExport?: boolean + ): Promise { + return await this.collectionsRepository.getCollection( + collectionIdOrAlias, + ignoreSettingExcludeEmailFromExport + ) } } diff --git a/src/collections/infra/repositories/CollectionsRepository.ts b/src/collections/infra/repositories/CollectionsRepository.ts index ccf22729..83fe9fe0 100644 --- a/src/collections/infra/repositories/CollectionsRepository.ts +++ b/src/collections/infra/repositories/CollectionsRepository.ts @@ -98,11 +98,13 @@ export enum GetMyDataCollectionItemsQueryParams { export class CollectionsRepository extends ApiRepository implements ICollectionsRepository { private readonly collectionsResourceName: string = 'dataverses' public async getCollection( - collectionIdOrAlias: number | string = ROOT_COLLECTION_ID + collectionIdOrAlias: number | string = ROOT_COLLECTION_ID, + ignoreSettingExcludeEmailFromExport?: boolean ): Promise { return this.doGet(`/${this.collectionsResourceName}/${collectionIdOrAlias}`, true, { returnOwners: true, - returnChildCount: true + returnChildCount: true, + ignoreSettingExcludeEmailFromExport: ignoreSettingExcludeEmailFromExport }) .then((response) => transformCollectionResponseToCollection(response)) .catch((error) => {