[core] Make DataInstance extend AccessibleResource#10365
Open
arnav-makkar wants to merge 4 commits intoaces:mainfrom
Open
[core] Make DataInstance extend AccessibleResource#10365arnav-makkar wants to merge 4 commits intoaces:mainfrom
arnav-makkar wants to merge 4 commits intoaces:mainfrom
Conversation
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.
Brief summary of changes
DataInstancecontract to extend both\JsonSerializableand\LORIS\StudyEntities\AccessibleResource, makingisAccessibleBy(\User): boolmandatory for all implementers.src/Data/Filters/AccessibleResourceFilter.phpby removing the runtimeinstanceof AccessibleResourceguard and callingisAccessibleBy()directly.src/StudyEntities/DataInstanceAccess.phpto centralize common center/project access checks (including getter variants and scalar ID normalization with fail-closed behavior).isAccessibleBy()implementations for all previously missingDataInstanceclasses, using shared helper logic for standard cases and explicit custom logic for exceptions (e.g., MRI violations, protocol-check violations, DICOM no-session rows, permission-gated DTOs).i. contract enforcement (
DataInstanceContractTest)ii. helper behavior (
DataInstanceAccessTest)iii. custom exception behavior (
DataInstanceBehaviorTest)Testing instructions (if applicable)
docker compose run -T --rm unit-tests vendor/bin/phpunit --configuration test/phpunit.xml test/unittests/DataInstanceContractTest.php test/unittests/DataInstanceAccessTest.php test/unittests/DataInstanceBehaviorTest.phpOK (16 tests, 139 assertions)Link(s) to related issue(s)