After enabling the content access module , content authors are not able to see unpublished content created by them.

Any ideas , what I am doing wrong?

Thanks in Advance!!

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

secretsayan created an issue. See original summary.

gisle’s picture

Status: Active » Patch (to be ported)
Related issues: +#1225520: Add 'View own unpublished content' setting

This is fixed in the Drupal 7 version. Patch in #1225520: Add 'View own unpublished content' setting needs to be ported to Drupal 8.

gisle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

All bug fixes go into the most recent branch.

steven jones’s picture

Version: 2.0.x-dev » 2.1.x-dev
Status: Patch (to be ported) » Needs work

Oh fun, looks like core now expects us to do different things for unpublished nodes: https://www.drupal.org/docs/develop/drupal-apis/writing-a-module-that-ha...

We should get some tests on the go to confirm what the current behaviour is and if we need to change content access. It might be that we need to make a listing page so that we rely on the node grants DB tables entirely, rather than some access callback.

steven jones’s picture

I can confirm that with a user that can view unpublished content, they can view a node directly, but in the listing for nodes, say in a view, there's no grants for that node in the database, and so the user can't view that node in the listing.

So yeah, this needs a test, and then probably a fix to get this working. Given that I'm thinking of jumping to a 3.x version of the module I'm wondering if it would make sense to do it in that version, and then we don't spring unexpected changes on site owners in a 2.2.0 release, because this could have weird side effects maybe?

I know that I have a site where I actually process the unpublished nodes through something that looks basically like content access' code, so that the unpublished nodes have the correct records and can be viewed in listings. And I'd like to kind of have notice that I'd need to adjust that.

steven jones’s picture

I reckon we should implement 'view_unpublished' and 'view_own_unpublished' type settings, that mirror the 'view' and 'view_own' settings that we have already, so that people can configure their sites appropriately.

steven jones’s picture

Made a start on this one, at the moment only handling the view and view own cases for unpublished content, but that's because I think core handles the edit and delete cases for us? Anyway, something to check on I suspect.

I did think it made sense to do this one before #3579507: Re-work the author grant realms but I think that one simplifies the code so much that actually, we might want to do that one first, and then this one.
The code around the owner stuff is super complex at the moment because it's trying to do the job of the node_access system for it.

And while I think of it...do we need new realms here? I don't think we do as they'll be a direct mirror of the usual ones for published nodes.

steven jones’s picture

Version: 2.1.x-dev » 3.0.x-dev

I think we can work on this now.