Skip to content

feat(share): add paginated share-review source API - #64116

Draft
AndyScherzinger wants to merge 1 commit into
masterfrom
feat/share-review-paginated-source
Draft

feat(share): add paginated share-review source API#64116
AndyScherzinger wants to merge 1 commit into
masterfrom
feat/share-review-paginated-source

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Sep 8, 2026

Copy link
Copy Markdown
Member

To put the LoC in context:

Lines
Code 454
Comments 601
Blank 129
Total added 1,184
Area Code Comments Blank Total
lib/public (the API itself) 177 578 56 811
tests 263 23 73 359
generated autoload 14 0 0 14
All 454 601 129 1,184

Summary

Extends the share-review API added in #61543 so that a review app can page through a source's shares instead of asking for all of them. IShareReviewSource::getShares() returns everything at once, which stops being usable on instances with many shares; the review UI had to guard itself with a row limit.

Everything here is additive — the 34.0.2 interface, entry and event are unchanged, and a source that implements only the old interface keeps working.

Every new class, method, constant and parameter is tagged @since 35.0.1 (the Consumable/Implementable attributes carry the same version), matching the backport target of this PR — as the v1 API is tagged 34.0.2.

New in OCP\Share\ShareReview:

  • IPaginatedShareReviewSource (extends IShareReviewSource): queryShares() for one page, countShares() and countSharesByType() and countSharesByInitiator() for counts without rows, getShare() for a keyed lookup (replacing "list everything to find one share"), getDisplayName() for a localized tab label — getName() stays the stable, non-translated source id, and its docblock now says so.
  • ShareReviewQuery / ShareReviewCounts / ShareReviewPage: the query contract — pagination, a whitelisted sort field, one substring search, and filters for share type, password, expiration range, modification range, scoped identity substrings, exact initiator/recipient/token id lists and opaque permission ids. The contract is fixed and identical for every source, so a review app can offer the same table controls on every tab. Sources evaluate it in SQL; the docblocks state the rules a source must honour (secondary sort on the primary key, NULLs last, LIKE escaping, exact token matching, empty list matches nothing).
  • ShareReviewActionContext: carries the acting user and the scope (operator or self) from the review app into the owning app, which forwards both into the access-check event verbatim. Needed for a personal self-audit view and for background jobs acting on behalf of a user.
  • IShareReviewSourceRemediation and IShareReviewSourceSnapshot: optional capabilities, discovered via instanceof, for remediating a share (password, expiration) instead of revoking it, and for serializing a share before deletion so a review app can offer a recycle bin. No source is forced to grow beyond IShareReviewSource.
  • ShareReviewAccessCheckEvent: gains an action (delete / remediate / restore), the acting user and the scope, all optional, with the default reproducing the 34.0.2 behaviour. The docblock documents who dispatches each action, what a listener must verify per scope, and how a listener written against 34.0.2 behaves.

The API is deliberately complete for the features planned on top of it (remediation, recycle bin, dashboard aggregates, personal self-audit view, rules engine), because an interface cannot gain methods after its first release without breaking implementations.

Implementations exist and are tested against this branch, and their pull requests follow once this is merged: Files (in the share-review app), Forms, Deck and Tables.

Docs for the v2 contract: nextcloud/documentation#15592 (draft, kept in sync with this PR until both are merged).

TODO

  • app-side pull requests (Forms, Deck, Tables, share-review app) — they declare a server range that includes this API
  • documentation pull request for the extended contract and the access-check event — docs(events): describe the paginated share-review source API documentation#15592 (draft, kept in sync with this PR)
  • backport to stable35 once this lands — the @since tags already name 35.0.1, so the backport needs no retagging

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@AndyScherzinger
AndyScherzinger force-pushed the feat/share-review-paginated-source branch 2 times, most recently from 15f9605 to 6e1ddfd Compare September 8, 2026 16:55
@AndyScherzinger AndyScherzinger added this to the Nextcloud 36 milestone Sep 8, 2026
@AndyScherzinger

Copy link
Copy Markdown
Member Author

/backport to stable35

@AndyScherzinger

AndyScherzinger commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Docs for this API: nextcloud/documentation#15592 (draft, kept in sync with this PR until both are merged).

@AndyScherzinger AndyScherzinger added the pending documentation This pull request needs an associated documentation update label Sep 8, 2026
Add IPaginatedShareReviewSource, extending IShareReviewSource with
page-wise listing (queryShares), counts (countShares, countSharesByType),
a keyed getShare() lookup and a localized getDisplayName(), so review
apps stay usable on instances with very many shares. The query contract
(ShareReviewQuery/ShareReviewCounts/ShareReviewPage) fixes sortable,
searchable and filterable fields identically for every source.

Ship the optional IShareReviewSourceRemediation and
IShareReviewSourceSnapshot capability interfaces and extend
ShareReviewAccessCheckEvent with an action, acting user and scope, all
additively — the 34.0.2 API is released and stays untouched.

Assisted-by: Claude Code:claude-opus-5
Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger force-pushed the feat/share-review-paginated-source branch from 6e1ddfd to ce1d4b5 Compare September 9, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress AI assisted backport-request enhancement force-e2e-tests pending documentation This pull request needs an associated documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants