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 thecontent_reviewed_date_reviewquery tag, sohook_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 implementshook_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 astatuscondition 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
Comment #3
ajetiv1fixed in 0d2ab72 following the proposal; lists four changes and the new drafts-cleanup permission; tests cover the cases.