[MGNLUI-6644] Default JCR Chooser shows system nodes Created: 01/Apr/21  Updated: 05/May/21

Status: Open
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 6.2.6, 6.2.7
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Chris Jennings Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File MGNLUI-issue.png    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Steps to reproduce

  1.  Define a content type that references itself or another type.
  2.  Define an app that uses the above content type.
  3. Create an item.
  4. Create another item and attempt to link it to the first. The default JCR Chooser will be used as per docs.
  5. Switch the chooser's workbench from tree view to list.

Expected results

  1. I would expect the system nodes (rep:accesscontrol, entry, everyone, rep:policy) to be hidden. They are not usable and they are not shown in other workbench list views (ie. Pages, Assets)

Actual results

  1. System nodes are visible and can be selected. See screenshot.

Workaround

#  I think the default app could be extended to explicitly filter nodes by type.

Development notes



 Comments   
Comment by Chris Jennings [ 01/Apr/21 ]

It is possible to configure a minimal datasource and chooser dialog.
In /dialogs add a YAML file such as:

thing-chooser.yaml

class: info.magnolia.ui.chooser.definition.SingleItemWorkbenchChooserDefinition
workbenchChooser: 
  datasource: 
    $type: jcrDatasource
    workspace: <YOUR-WORKSPACE>
    allowedNodeTypes: 
      - <YOUR-TYPE>
      - <ANOTHER-TYPE>

Then extend the app YAML file like:

things.yaml

subApps: 
  detail: 
    form: 
      properties: 
        <LINKED-PROPERTY-NAME>:
          chooserId: YOUR-MODULE:thing-chooser
Comment by Roman Kovařík [ 05/May/21 ]

For the record, the datasource could be defined at link field level, there should be no need to configure a custom chooser, e.g.:

      $type: linkField
      datasource:
        $type: jcrDatasource
        workspace: dam
        allowedNodeTypes: 
          - mgnl:asset
          - mgnl:folder
Generated at Mon Feb 12 09:38:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.