Users with permission 'View any unpublished content' are not granted access to node if the node is yet to be published i.e. node->status = 1.

This happens if you are using revision on content type and don't publish a newly created node when saving it.
Example:
- You have one user that creates the content and another that shall approve them before publishing.
- The second user has permission 'View any unpublished content' but are not granted access to the content.
- The second user cannot publish the node because of access denied.

Comments

IcePhenom’s picture

Issue summary: View changes

Bad comment

IcePhenom’s picture

Issue summary: View changes

Bad comment

IcePhenom’s picture

This patch fixes this

IcePhenom’s picture

Status: Active » Needs review
kiss.jozsef’s picture

StatusFileSize
new1.53 KB

Added 'view any unpublished ' . $type . ' content' permission so it works with view unpublished module

ben.bunk’s picture

The patch in comment #5 worked for me in the D7 version.

zlatev’s picture

StatusFileSize
new881 bytes

I have created the same patch for workbench_moderation module. Maybe more general approach should be considered regarding this issues as all modules working with revisions will hit it.

adci_contributor’s picture

Hi, guys!

Thanks for your big work.
Your patches partially correspond to the work of this module.
With any your patches I can get correct access to the node (published or unpublished) by direct link.
But if any node published on the front page, it doesn’t appear there.
I can’t add your patches to our code, but they can be used by someone if it fits they functionality.

adci_contributor’s picture

Status: Needs review » Active
adci_contributor’s picture

Hello everyone!
We solved this problem in another way. All the changes you can already see in the dev-branch.

adci_contributor’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

lemuelsantos’s picture

Version: 7.x-1.5 » 8.x-1.x-dev
Priority: Normal » Major
StatusFileSize
new1.17 KB

I believe this is still an issue for version 8.x-1.2 and 8.x-1.x-dev the approach to ignore unpublished node at hook_node_access_records has side effects on the admin/content view and generate conflicts with core and workbench module that for the "view own/any unpublished content" permissions.

The issue is because on hook_node_access_records unpublished nodes are skipped but hook_node_grants is ALSO called for unpublished nodes and there WON'T be any grants for unpublished nodes which results the unpublished nodes not appear in the admin/content if the users don't have the "bypass content access control". This will also happen in any other view that is not "disabling SQL rewriting" (disable node access checks).

I believe that approach must be reviewed in order to add grants for unpublished nodes and allow users with "view any unpublished content", "view own unpublished content" (workbench) or even "edit any [content type] content" permissions.

My workaround for now is adding a grant for "edit any [content type] content" and allow users with that permission view/update the node.

Please let me know your thoughts... thanks...