PS-1087 feat: replace TagFilterRule with AttributeFilterRule (AQL con… - #879
Open
4rthem wants to merge 1 commit into
Open
PS-1087 feat: replace TagFilterRule with AttributeFilterRule (AQL con…#8794rthem wants to merge 1 commit into
4rthem wants to merge 1 commit into
Conversation
…ditions with multiple user/group targets)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the legacy TagFilterRule mechanism (tag include/exclude lists) with a new AttributeFilterRule system that uses AQL conditions and supports multiple user/group targets, wiring it through the Databox API search filtering and the Databox React client workspace UI.
Changes:
- Introduces
AttributeFilterRule(+targets) entity/model/API, migration, admin UI, and output/input transformers; removes TagFilterRule equivalents. - Applies attribute filter rules at search time by converting stored AQL conditions into Elasticsearch queries (fail-closed on errors), and adds
NOTsupport in AQL-to-ES conversion. - Updates Databox client workspace management UI to edit filter rules via the AQL condition dialog, plus translation key updates.
Reviewed changes
Copilot reviewed 46 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| databox/client/translations/it.json | Updates UI strings/keys for filter rules and related workspace management labels. |
| databox/client/translations/es.json | Updates UI strings/keys for filter rules and related workspace management labels. |
| databox/client/translations/en.json | Replaces tag-rule strings with filter-rule strings in English. |
| databox/client/translations/de.json | Large translation re-sync including new filter-rule strings and locale block relocation. |
| databox/client/src/types.ts | Replaces TagFilterRule type with AttributeFilterRule (users/groups + condition). |
| databox/client/src/components/Media/TagFilterRule/TagRules.tsx | Removes legacy tag-rule UI. |
| databox/client/src/components/Media/TagFilterRule/FilterRule.tsx | Removes legacy tag-rule form (tag include/exclude). |
| databox/client/src/components/Media/Search/AQL/SearchConditionDialog.tsx | Adds optional workspaceId to load/index workspace-scoped attribute definitions. |
| databox/client/src/components/Media/AttributeFilterRule/FilterRuleForm.tsx | Adds new filter-rule form (multi user/group targets + AQL condition editor). |
| databox/client/src/components/Media/AttributeFilterRule/AttributeFilterRules.tsx | Adds listing/editing UI for attribute filter rules in a workspace. |
| databox/client/src/components/Dialog/Workspace/WorkspaceDialog.tsx | Replaces Tag Rules tab with Filter Rules tab. |
| databox/client/src/components/Dialog/Workspace/FilterRulesTab.tsx | Switches tab content from tag rules to attribute filter rules. |
| databox/client/src/api/tag-filter-rule.ts | Removes legacy tag-filter-rule client API calls. |
| databox/client/src/api/attribute-filter-rule.ts | Adds client API calls for attribute-filter-rules CRUD. |
| databox/api/tests/Search/AssetSearchPermissionsTest.php | Updates tag-rule test to attribute-rule-on-tags + adds attribute condition + targeting tests. |
| databox/api/tests/DataboxTestTrait.php | Swaps TagFilterManager helper for AttributeFilterManager. |
| databox/api/src/Validator/ValidAQLConstraintValidator.php | Adds validator to check AQL condition syntax via AttributeSearch. |
| databox/api/src/Validator/ValidAQLConstraint.php | Adds constraint attribute for validating AQL conditions. |
| databox/api/src/Service/Workspace/WorkspaceDuplicateManager.php | Duplicates attribute filter rules when duplicating a workspace (no ID remap). |
| databox/api/src/Security/Voter/AttributeFilterRuleVoter.php | Replaces voter subject type from TagFilterRule to AttributeFilterRule. |
| databox/api/src/Security/TagFilterManager.php | Removes legacy tag filter manager. |
| databox/api/src/Security/AttributeFilterManager.php | Adds manager for saving rules and retrieving per-user conditions by workspace. |
| databox/api/src/Repository/Core/TagFilterRuleRepository.php | Removes legacy repository. |
| databox/api/src/Repository/Core/AttributeFilterRuleRepository.php | Adds repository to fetch rules that apply to a user (user/group/none). |
| databox/api/src/Repository/Core/AttributeDefinitionRepository.php | Adds method to fetch all searchable attributes (ignoring permissions). |
| databox/api/src/Entity/Core/TagFilterRule.php | Removes legacy TagFilterRule entity. |
| databox/api/src/Entity/Core/AttributeFilterRuleTarget.php | Adds target entity for user/group targeting (many targets per rule). |
| databox/api/src/Entity/Core/AttributeFilterRule.php | Adds attribute filter rule entity with AQL condition and target collection. |
| databox/api/src/Elasticsearch/AttributeSearch.php | Adds method to build clusters for all searchable attributes (global). |
| databox/api/src/Elasticsearch/AssetSearch.php | Applies attribute filter rules during asset search; logs and fails-closed on invalid conditions. |
| databox/api/src/Elasticsearch/AQL/LogicOperatorEnum.php | Adds NOT operator. |
| databox/api/src/Elasticsearch/AQL/AQLToESQuery.php | Maps NOT operator to ES bool must_not. |
| databox/api/src/Elasticsearch/AQL/AQLGrammar.php | Updates generated grammar for NOT expression whitespace handling. |
| databox/api/src/Elasticsearch/AQL/AQLGrammar.peg | Updates PEG grammar for NOT expression whitespace handling. |
| databox/api/src/Doctrine/Delete/WorkspaceDelete.php | Updates workspace deletion to delete attribute filter rules instead of tag filter rules. |
| databox/api/src/Controller/Admin/DashboardController.php | Updates admin menu entry to Attribute Filter Rule CRUD. |
| databox/api/src/Controller/Admin/AttributeFilterRuleCrudController.php | Adds CRUD controller for attribute filter rules; updates fields/filters. |
| databox/api/src/Api/Provider/AttributeFilterRuleCollectionProvider.php | Provides attribute-filter-rule collections filtered by workspace. |
| databox/api/src/Api/OutputTransformer/TagFilterRuleOutputProcessor.php | Removes legacy output transformer. |
| databox/api/src/Api/OutputTransformer/AttributeFilterRuleOutputProcessor.php | Adds output transformer that resolves user/group display names. |
| databox/api/src/Api/Model/Output/TagFilterRuleOutput.php | Removes legacy output DTO. |
| databox/api/src/Api/Model/Output/AttributeFilterRuleOutput.php | Adds output DTO exposing users/groups arrays + condition. |
| databox/api/src/Api/Model/Input/AttributeFilterRuleInput.php | Adds input DTO for userIds/groupIds + condition. |
| databox/api/src/Api/InputTransformer/TagFilterRuleInputTransformer.php | Removes legacy input transformer. |
| databox/api/src/Api/InputTransformer/AttributeFilterRuleInputTransformer.php | Adds input transformer for setting workspace, targets, and condition. |
| databox/api/migrations/Version20260805170000.php | Migration creating new tables, converting old rules to AQL, dropping old tables. |
| databox/api/config/packages/alchemy_track.yaml | Updates track object index mapping to AttributeFilterRule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+66
to
+68
| #[ORM\Column(type: Types::TEXT)] | ||
| #[ValidAQLConstraint] | ||
| protected ?string $condition = null; |
Comment on lines
+238
to
+242
| $conditionQuery = $this->attributeSearch->buildConditionQuery( | ||
| $this->attributeSearch->buildAllAttributeDefinitionsGroups(), | ||
| $condition, | ||
| $options | ||
| ); |
Comment on lines
+93
to
+97
| // Entity UUIDs embedded in the AQL condition (e.g. @tag references) are NOT | ||
| // remapped to the duplicated workspace's entities: such rules fail closed. | ||
| foreach ($items as $item) { | ||
| $i = new TagFilterRule(); | ||
| $i->setExclude($item->getExclude()->map($replace)); | ||
| $i->setInclude($item->getInclude()->map($replace)); | ||
| $i = new AttributeFilterRule(); | ||
| $i->setCondition($item->getCondition()); |
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.
…ditions with multiple user/group targets)