diff --git a/docs/useCases.md b/docs/useCases.md index bcedbf1c..448a91e2 100644 --- a/docs/useCases.md +++ b/docs/useCases.md @@ -14,6 +14,7 @@ The different use cases currently available in the package are classified below, - [Get Dataset Citation Text](#get-dataset-citation-text) - [Get Dataset Locks](#get-dataset-locks) - [Get Dataset Summary Field Names](#get-dataset-summary-field-names) + - [Get User Permissions on a Dataset](#get-user-permissions-on-a-dataset) - [List All Datasets](#list-all-datasets) - [Files](#Files) - [Metadata Blocks](#metadata-blocks) @@ -130,6 +131,32 @@ getDatasetSummaryFieldNames *See [use case](../src/datasets/domain/useCases/GetDatasetSummaryFieldNames.ts) definition*. +#### Get User Permissions on a Dataset + +Returns an instance of [DatasetUserPermissions](../src/datasets/domain/models/DatasetUserPermissions.ts) that includes the permissions that the calling user has on a particular Dataset. + +##### Example call: + +````typescript +import { getDatasetUserPermissions } from '@iqss/dataverse-client-javascript' + +/* ... */ + +const datasetId = 'doi:10.77777/FK2/AAAAAA'; + +getDatasetUserPermissions + .execute(datasetId) + .then((permissions: DatasetUserPermissions) => { + /* ... */ + }); + +/* ... */ +```` + +*See [use case](../src/datasets/domain/useCases/GetDatasetUserPermissions.ts) definition*. + +The `datasetId` parameter can be a string, for persistent identifiers, or a number, for numeric identifiers. + #### List All Datasets Returns an instance of [DatasetPreviewSubset](../src/datasets/domain/models/DatasetPreviewSubset.ts) that contains reduced information for each dataset that the calling user can access in the installation. diff --git a/src/datasets/domain/useCases/GetDatasetUserPermissions.ts b/src/datasets/domain/useCases/GetDatasetUserPermissions.ts index 594e0ba6..13055977 100644 --- a/src/datasets/domain/useCases/GetDatasetUserPermissions.ts +++ b/src/datasets/domain/useCases/GetDatasetUserPermissions.ts @@ -9,6 +9,12 @@ export class GetDatasetUserPermissions implements UseCase} + */ async execute(datasetId: number | string): Promise { return await this.datasetsRepository.getDatasetUserPermissions(datasetId); }