Repository navigation
feat(search): _referenced filters objects by a field of the row their property references - #4678
Merged
Merged
Conversation
… property references The forward twin of _related: an EXISTS subquery joined referenced._uuid = object.<property>, carrying the referenced schema's own read access predicate, same grammar and refusals. A camel-case property reads its snake-case magic-table column in both directions. Assisted-by: ClaudeCode:claude-opus-5-5
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.
What
_referenced[<schema>][<property>][<field>]=<value>on the object search: objects whose OWN<property>holds the uuid of a row of<schema>that satisfies the conditions. The forward twin of_related(which only asks about rows pointing AT the object), with the same grammar (operatorseq ne gt gte lt lte in, lists asin, numbered blocks for "two different rows") and the same refusals (an unusable block or an unknown schema is a 400-class error, never a dropped filter).returns the beschikkingen whose
subsidieaanvraagpoints at an application of that case.Authorization
Each block becomes
EXISTS (SELECT 1 FROM <referenced table> rel WHERE rel._uuid = t.<property> AND rel._deleted IS NULL AND (<referenced schema's read predicate>) AND <conditions>). The predicate isMagicRbacHandler::buildRbacPredicateForAlias(<referenced schema>, alias, 'read'), the same one_relateduses, and the clause refuses to render without it. So a referenced row the caller may not read never decides which objects they see; the outer schema's own RBAC is applied as before.Also fixed (same clause)
A property or condition field written as the schema spells it (
propertyDefinition) is now read from its snake-case magic-table column (property_definition), for_relatedtoo. It was quoted as written, a column that does not exist. Snake-case names are unchanged.Why
Board DqSubsidie lists beschikkingen, voorschotten and vaststellingen on a case; those rows reference the subsidy application, not the case. Today
?subsidieaanvraag.case=Xon a uuid property is silently read assubsidieaanvraag IN ('X'): an empty list, no error.Not in scope
Facets over
_referencedand the multi-schema raw UNION search path; neither supports_relatedeither.Consumer
No nextcloud-vue change: a manifest filter written with the flat bracket key passes through
buildQueryStringas written and its value takes tokens:{ "_referenced[subsidieAanvraag][subsidieaanvraag][case]": "@objectId" }.Verified locally
tests/Unit/Service/Query/39 tests (6 new inReferencedRowFilterTest: parse direction, refusal naming_referenced, forward join on columns and on JSON storage, camel-case column, applier with the referenced schema's RBAC predicate),MagicSearchHandlerTest25,MagicSearchHandlerMetadataOperatorTest17: all OK. The new tests fail on development (no direction, no_referenced).composer check:strictonce: lint, migration-version, phpcs, phpmd, psalm ("No errors found"), phpstan ("No errors") green; test:all 26,291 tests, 15 errors, the same inheritedAuditTrail*/DraftRemovalAuditRowDB tests that need the server'sOC\DB\Schema\Table(also red on development, recorded on feat(flow-runs): per-flow run summary, and since/flowIds on the run history #4672 and feat(flow): each step records when it started, and a node can write log lines #4674).AI-assisted: written with Claude Code.