Repository navigation
OpenConceptLab/ocl_online#750 | A source's mapped-sources list names only target sources the requester can view - #1042
Merged
Conversation
…only target sources the requester can view, and excludeSelf leaves the source out on version routes
snyaggarwal
force-pushed
the
ocl_online-750-mapped-sources-access
branch
from
November 24, 2026 03:13
9bc21a6 to
300ee40
Compare
…leted target sources for staff too; tests for a public release of a private source and a user-owned source's excludeSelf
snyaggarwal
commented
Nov 24, 2026
snyaggarwal
left a comment
Contributor
Author
There was a problem hiding this comment.
Verdict: ready to merge once CI passes.
Reviewed the full diff (high effort: line-by-line, removed behavior, callers, repo conventions).
- Access: the list filters targets with
get_viewable_versions_criteria(user), the same rule as the collection-version lists in #1034/#1035. Private targets are visible only to their owner, org members and staff. A public release under a private HEAD stays hidden from outsiders. It's a single query with nounion, sonum_foundand paging match the filtered list. Source lists aren't response-cached, so there's no cross-user cache leak. excludeSelf: excluding by mnemonic plus owner leaves out HEAD and every version on version routes. It's correct for both org-owned and user-owned sources (NULL owner becomesIS NULL).- Callers: the existing mocked view tests and the #1041 index test call
get_mapped_sources(exclude_self=False)unchanged, so they're unaffected.
The review found three issues, all fixed in 3ea1be3:
- Staff still saw deleted target sources, because the staff path skips the filter.
get_mapped_sourcesnow drops inactive targets for everyone. - Added a test where the target is a public release of a private source.
- Added an
excludeSelftest for a user-owned source on its version route.
Nothing else outstanding. The new tests haven't run locally because local ES was down, so CI is their first run.
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.
Fixes OpenConceptLab/ocl_online#750
What changed
/…/sources/<source>/[<version>/]mapped-sources/now filters the target sources byget_viewable_versions_criteria(user), the same rule used for collection versions in OpenConceptLab/ocl_online#742 | A collection's expansions list holds only versions the requester can view #1034 and OpenConceptLab/ocl_online#741 | Collection versions holding a resource, and contains, name only versions viewable with their HEAD #1035. Anonymous users and outsiders no longer see private target sources. The owner, org members and staff still do. Deleted (inactive) target sources are left out for everyone, staff included, matching the other source lists.union), sonum_foundand paging headers match the filtered list on both the HEAD and version routes.excludeSelfon a version route now leaves out every version of the source, HEAD included. Mappings point at HEAD, so comparing against the version's id never excluded anything.Tests
core/sources/tests/tests_mapped_sources_access.py: anonymous, outsider, org member and staff against a public source that maps to a private one, on HEAD and version routes, with default,verboseandbriefoutput, paging headers,excludeSelfon both routes (org- and user-owned), a public release of a private source as a target, and a deleted target.🤖 Generated with Claude Code