Skip to content

Filter related-content identifiers by read permission in the CSV content export #38055

Open

Description

@dario-daza

Description

The CSV content export writes, for every relationship field, the identifiers of all related contentlets, whether or not the exporting user can read them. EditContentletAction.loadRelationships writes Contentlet::getIdentifier for each related record, and those records come from ContentletAPI.getFieldValue(contentlet, field), which takes no user, so nothing is permission-checked. A limited user who exports content therefore learns the identifiers of related content they cannot see.

This happens today in the legacy Content Search export. The Content Drive export (#37900) keeps the same behavior on purpose, for feature parity, through the CSV writer it moves out of downloadToExcel into a piece shared by both exports. That decision was made during the spec review of #37900 (#38043 (comment)), with the fix deferred to this ticket. Because the writer is shared, fixing it here changes both exports.

Expected behavior

  • The relationship column lists only the related contentlets the exporting user can read. Unreadable ones are left out of the list.
  • Nothing in the file, the response or the UI says how many related items were left out.
  • Users who can read every related item see no change.

Re-import must not lose data. The import turns the relationship column into the contentlet's related records when it saves it. A file exported by a limited user no longer lists the related items that user cannot read, so re-importing it could remove those relationships. The import must keep, for each relationship, the related contentlets the importing user cannot read, even though they are absent from the column. Relationships the user can read are still set from the column as today.

Out of scope: changing which related items the UI shows, changing relationship permissions themselves, and any other column of the export.

Acceptance Criteria

Export

  • A limited user exporting a contentlet related to one readable and one unreadable contentlet gets only the readable identifier in the relationship column, in both the Content Search export and the Content Drive export
  • When every related contentlet is unreadable, the relationship cell is empty
  • A user who can read every related contentlet gets the same relationship column as today
  • No response header, message or toast reports how many related items were left out

Re-import

  • A limited user who exports, edits another field and re-imports a contentlet keeps its relationships to content they cannot read
  • Relationships to content the importing user can read are still added and removed according to the column, as today
  • A user who can read every related contentlet sees the same import behavior as today

Tests

  • Integration tests cover the export and re-import cases above with a limited user, and the test class is registered in a MainSuite

Priority

Medium

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions