Generated with the help of an LLM.

Problem/Motivation

A few dashboard listings show nodes the current user may not be allowed to view:

  • "Pending deletion" and "Recently deleted" read the module's own tables and load the nodes with ReviewQuery::loadNodes(), without a $node->access('view') check. They also skip the content_reviewed_date_review query tag, so hook_query_content_reviewed_date_review_alter() can't scope them. "Recently deleted" shows the title, path, reason, requester and deleter of deleted pages.
  • The other listings use an entity query with accessCheck(TRUE). But core's node access alter does nothing when no module implements hook_node_grants(), so it doesn't filter unpublished nodes. So "Unpublished drafts" and "Recently reviewed" list unpublished nodes, with their title, edit link and review note, to users without "view any unpublished content".

So a user with only "view content review dashboard" can see more than the rest of the site shows them. On sites where the dashboard is given to roles that can see everything anyway it doesn't matter, but the permission description doesn't suggest that.

Also related: the "Unpublished drafts" tab offers "Delete all old drafts on this page" to anyone with the dashboard permission and delete access. It also lists content that was unpublished by Scheduler. That's a pretty powerful action for a reporting permission. Maybe it should have its own permission?

Steps to reproduce

  • No node access module installed.
  • A role with "view content review dashboard" but without "view any unpublished content".
  • An unpublished node of a tracked type, owned by someone else.
  • As that role, open /admin/content/stale-review/drafts. The node is listed.

Proposed resolution

  • Filter the rows of these listings through $node->access('view'), or add a status condition unless the user has "view any unpublished content" (and handle "view own unpublished content").
  • For "Recently deleted", maybe restrict it to "administer content reviewed date", as there is no node left to check access on.
  • Run the deletion listings through the same query tag or alter hook, so sites can scope them.
  • Optionally a separate permission for the drafts cleanup.

What do you think?

Remaining tasks

  • Decide on the approach.
  • MR with tests.

User interface changes

Users see fewer rows on some tabs.

API changes

Maybe a new permission.

Data model changes

None.

Comments

svendecabooter created an issue. See original summary.

  • ajetiv1 committed 0d2ab722 on 1.2.x
    Issue #3636487 by svendecabooter, ajetiv1: Some dashboard tabs list...
ajetiv1’s picture

Status: Active » Fixed

fixed in 0d2ab72 following the proposal; lists four changes and the new drafts-cleanup permission; tests cover the cases.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.