Repository navigation
fix(api): only link and show datasets and use cases the caller may see - #360
Merged
anantjain341 merged 1 commit intoDec 2, 2026
Merged
Conversation
Linking a dataset or use case into a collaborative or use case checked only the item being changed and loaded the linked one by id alone, and the linked lists returned every linked item. A signed-in user could link another organisation's draft into their own collaborative and read its title and fields back there; use case ids are sequential. Linking now accepts only items the caller may see, with the same rules as getDataset and useCase(pk); anything else answers like a missing id. The linked lists, their counts and publishers show each reader only the items they may see, which also hides links made before this change. Search entries carry published linked items only. Replacing a list keeps the links the editor cannot see, since their list cannot name them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linking a dataset or use case into a collaborative or use case only checked the item being changed, and the linked lists returned every linked item. Someone could link another organisation's draft into their own collaborative and read it back there. Now linking and reading both follow the same visibility rules as
getDatasetanduseCase(pk): published items for everyone; drafts for the owner, members of the item's organisation whose role can view, people with a dataset grant, and superusers.Linking
addDatasetToCollaborative,addUsecaseToCollaborative,addDatasetToUseCase: an item the caller may not see is refused with the same error as a wrong id (Dataset with ID … does not exist.), so a hidden draft cannot be told apart from a missing one.updateCollaborativeDatasets,updateCollaborativeUseCases,updateUsecaseDatasets: a hidden id gets the existing errorThese dataset ids do not exist: …and nothing is saved.Reading
Each reader sees only the linked items they may see, in:
datasets,useCases,datasetCount,useCaseCount,publishersdatasets,datasetCount,publishersdatasetByCollaborative,datasetByUseCaseThis also hides links made before this change. Collaborative and use case search results list only published linked datasets and use cases.
API
No field, argument or type changes. Counts and
publishersnow match the list the reader is shown.Deploy
No migration and no mapping change; the release search refill rewrites collaborative and use case entries.