Skip to content

OpenConceptLab/ocl_online#750 | A source's mapped-sources list names only target sources the requester can view - #1042

Merged
snyaggarwal merged 2 commits into
masterfrom
ocl_online-750-mapped-sources-access
Nov 24, 2026
Merged

snyaggarwal merged 2 commits into
masterfrom
ocl_online-750-mapped-sources-access

Conversation

@snyaggarwal

@snyaggarwal snyaggarwal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes OpenConceptLab/ocl_online#750

What changed

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, verbose and brief output, paging headers, excludeSelf on both routes (org- and user-owned), a public release of a private source as a target, and a deleted target.

🤖 Generated with Claude Code

…only target sources the requester can view, and excludeSelf leaves the source out on version routes
@snyaggarwal
snyaggarwal force-pushed the ocl_online-750-mapped-sources-access branch from 9bc21a6 to 300ee40 Compare November 24, 2026 03:13
…leted target sources for staff too; tests for a public release of a private source and a user-owned source's excludeSelf

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 no union, so num_found and 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 becomes IS 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:

  1. Staff still saw deleted target sources, because the staff path skips the filter. get_mapped_sources now drops inactive targets for everyone.
  2. Added a test where the target is a public release of a private source.
  3. Added an excludeSelf test 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.

@snyaggarwal
snyaggarwal merged commit 6698333 into master Nov 24, 2026
3 checks passed
@snyaggarwal
snyaggarwal deleted the ocl_online-750-mapped-sources-access branch November 24, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant