Repository navigation
refactor: smaller cleanup tasks for casl refactor - #2759
Merged
Merged
Conversation
4 tasks done
4 tasks done
This was referenced Jun 3, 2026
Member
|
LGTM! ⭐ |
emigun
approved these changes
Jun 25, 2026
4 tasks done
nitrosx
added a commit
that referenced
this pull request
Aug 7, 2026
## Description Subsection of PR #2748 for datasets. PR depends on #2759 to be merged first. This unifies the datasetEndpointAccess and datasetInstanceAccess functions in CaslAbilityFactory, removes instance-level Action elements and adjusts all affected controllers to accommodate the change. The dataset-specific code is extracted into a separate module ## Fixes * The endpoints /proposals/:id/datasets and /samples/:id/datasets would not apply correct filters due to a mismatch between the used casl ability and checked Action elements ## Changes: * Replace CaslAbilityFactory.datasetsInstanceAccess and CaslAbilityFactory.datasetsEndpointAccess with one function CaslAbilityFactory.datasetAccess * Code for CaslAbilityFactory.datasetAccess is factored out into new module DatasetAbility * Remove all instance-level dataset Action elements * Adjust endpoint and instance auth logic in dataset controllers * Remove unused readOwner checks, treat readPublic as always true (datasets-access.service) * Adjust auth logic in samples, proposals, users and origdatablocks controllers where dataset abilities are used ## Tests included - [x] Included for each change/fix? - [x] Passing? <!-- Merge will not be approved unless tests pass --> ## Documentation - [x] swagger documentation updated (required for API changes) - [x] official documentation updated ### official documentation info <!-- If you have updated the official documentation, please provide PR # and URL of the updated pages --> ## Summary by Sourcery Consolidate dataset authorization into a single CASL ability and align controllers and access services with the simplified permission model. Bug Fixes: - Ensure /proposals/:id/datasets, /samples/:id/datasets, and other dataset-related endpoints apply correct filters based on unified dataset permissions for authenticated and unauthenticated users. Enhancements: - Replace separate dataset endpoint and instance access factories with a single datasetAccess ability using unified actions and conditions. - Simplify dataset-related controllers, V4 controllers, and access services to rely on generic Dataset* actions instead of owner/access/public-specific variants. - Remove numerous instance-level dataset Action enum values in favor of a smaller, clearer action set, adding AccessAny for elevated roles. - Treat public dataset reads consistently by defaulting unauthenticated access to published datasets and tightening v4 behavior to require public endpoints for anonymous users. - Update Swagger-guarded policies and related controllers (datasets, samples, proposals, origdatablocks, users) to use the new datasetAccess checks. Tests: - Adjust dataset controller specs to mock the new datasetAccess factory method and keep authorization tests passing.
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.
Description
A few smaller changes part of PR #2748. This branch will serve as a base for the individual collection refactors.
Fixes
Changes:
Tests included
Documentation
Summary by Sourcery
Align CASL action naming and subject configuration while cleaning up access control wiring and fixing a dataset count test filter.
Bug Fixes:
Enhancements: