Skip to content

restrict access to /books/zims endpoint - #542

Merged
elfkuzco merged 1 commit into
mainfrom
restrict-access-to-zims-endpoint
Sep 22, 2026
Merged

elfkuzco merged 1 commit into
mainfrom
restrict-access-to-zims-endpoint

Conversation

@elfkuzco

@elfkuzco elfkuzco commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This PR uses the list of accessible collection IDs for a user to limit the download/view URLs they get for books. In addition, it adds new roles collection-viewer, global-viewer and changes viewer to public-viewer. This allows specific accounts to view books/titles belonging to both public/private collections

Changes

  • add migration to update existing viewer roles to public-viewer (which is now the new default)
  • add new role collection-viewer and update codebase to handle it along with collection-editor
  • use list of accessible collection IDs to restrict URLs retrieved in get_zim_urls
  • update UI to handle new role collection-viewer, global-viewer, public-viewer

This closes #538

@elfkuzco elfkuzco self-assigned this Sep 22, 2026
@elfkuzco
elfkuzco requested a review from benoit74 September 22, 2026 09:31
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.96%. Comparing base (6c9bd12) to head (a02305d).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
backend/src/cms_backend/schemas/models.py 33.33% 0 Missing and 2 partials ⚠️
backend/src/cms_backend/db/account.py 50.00% 0 Missing and 1 partial ⚠️
...ackend/src/cms_backend/db/collection_permission.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #542      +/-   ##
==========================================
+ Coverage   81.93%   81.96%   +0.03%     
==========================================
  Files          70       70              
  Lines        4456     4458       +2     
  Branches      528      528              
==========================================
+ Hits         3651     3654       +3     
+ Misses        642      641       -1     
  Partials      163      163              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@elfkuzco

Copy link
Copy Markdown
Contributor Author

I didn't take into account this last comment: #538 (comment)

adding new commits...

@benoit74 benoit74 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thank you!

@elfkuzco
elfkuzco force-pushed the restrict-access-to-zims-endpoint branch from baf080e to a02305d Compare September 22, 2026 13:11
@elfkuzco
elfkuzco merged commit 4ef2858 into main Sep 22, 2026
6 of 7 checks passed
@elfkuzco
elfkuzco deleted the restrict-access-to-zims-endpoint branch September 22, 2026 13:18
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.

Restrict access to GET /books/zims API endpoint

2 participants