Closed (fixed)
Project:
Content Access
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2011 at 13:03 UTC
Updated:
11 Jul 2020 at 13:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
markusa commented+1 With this module enabled the core 'view your own unpublished' privelege is invalidated....seems like this is a bug....although it would be nice to have this added as a feature on a per content basis
Comment #2
DrupalDan commentedI added a view to allow users to see their own nodes, including unpublished ones, but the view shows no result of my own unpublished nodes unless I submitted nodes as an admin. If I just log in as an authenticated user and submit some nodes, they won't show up in that view if not published, even though the privilege "view one's own unpublished nodes" are given to authenticated users . This problem baffles me several days and I just found it has something to do with the content access module. If it is disabled the user's unpublished nodes got shown in a view but not when the module is enabled. Hopefully this problem can be fixed soon. Thank you all.
Comment #3
jelle_sA quick fix is changing
to
on line 115 of content_access.module
Comment #4
etron770 commentedIts not working f.e in the workbench modules for the drafts
for views see:
http://mbharris.co.uk/content/access-control-module-prevents-view-users-...
Comment #5
pcho commentedJelle_S,
The solution seems to work on my end, although we are going to test it further to make sure it doesn't deprecate other functionality. For now, I have encapsulated your recommendation into a patch file
Comment #6
wickwood commentedThe patch in #5 works for me. Frankly I don't see why the exclusion of unpublished nodes was ever included and this problem tripped me up twice now and wasted days of time trying to figure it out.
Comment #7
marblegravy commentedPatch at #5 works as advertised in some cases.
I was trying to allow Workbench Moderation's View all unpublished content permission to work and this will allow it to function as expected For the Workbench Views only. However, it works too well for the ootb Administration Views content view and allows anyone with access to view the page the ability to see unpublished content.
For future reference, it seems that this is a known issue that will not be fixed -> #1264482: Cause and work around of user not seeing own unpublished content in views
So whatever workaround you can find that works for you is the recommended approach!
Comment #8
wickwood commentedYou're right Marblegravy, it works too well! The patch in #5 also exposes unpublished content to anyone, even anonymous users, if there is no other restriction from another module.
I had created another patch for Workbench Moderation that would restricts who can view unpublished content by content type, see https://drupal.org/node/1447886#comment-7570151 for this patch.
Anyway, I was using my Workbench Moderation patch with this Content Access patch, and just discovered that this patch allows unpublished content that I'm not moderating to be visible to any and everyone.
Thanks for the reference. It is disappointing that this will not be properly fixed. If I come up with another solution, I will post back again.
Comment #9
hefox commentedComment #10
hefox commentedQuick minimally tested patch
For further information, see #1147526: Unpublished nodes displayed to anonymous users where the !$node->status line was added to prevent the mentioned issue above
Comment #11
highfellow commentedI can confirm that the patch in #10 is working for me.
Comment #12
garamani commentedThe patch #10 doesn't work for me.
I applied patch on 3 different version of content access and The user still cant see own unpublished content; however authenticated users have "View own unpublished content" access permission.
Comment #13
garamani commentedThe patch #5 doesn't work neither!
I load views content via panels module. maybe my problem is not related to content access. I just want the user be able to see his/her own unpublished content.
Comment #14
garamani commentedIt's weird but after removing content acceess permissions (structure>content types>your-content-type>access control) and reapplying permissions, the patch #10 WORKS!
I also unchecked the "per content node access control" checkbox.
Comment #15
milesw commentedPatch #10 worked for me, resolving the problem I had with unpublished content not appearing within Workbench.
Make sure to rebuild permissions (/admin/reports/status/rebuild) after applying the patch!
Comment #16
hefox commentedNeeds update operation to set that node access needs rebuild
also
$account->uid should be before user_access since it's the faster check
Comment #17
bkosborneHmm, I'm having trouble understanding the reasoning here. Looking thru the node_access function, the following code is executed before any
hook_node_grants()implementations are even considered:So how does the current version of Content Access interfere with this at all? The logic above states if a user is trying to view an unpublished node, they are the owner of the node, and they have the permission "view own unpublished content", then they will be able to view it.
Comment #18
milesw commented@bkosborne: I think the issue here is specific to grants. With node queries (including Views), the node_access() function is not used.
Comment #19
bkosborneYes okay that makes sense, since I assume whatever Views does with limiting search results has to be down purely in the query, so we need to add node access records for an unpublished realm.
Rerolled to include an update hook to enable the rebuild access permissions flag.
I've tested this patch and it seems to work as intended.
Comment #20
bkosborneForgot to rearrange the ternary conditions as per #16
Comment #21
Yaron Tal commentedPatch works perfectly here.
This line is a bit long though. Can we split this in two lines?
Besides that I am all for committing this.
Comment #22
pianomansam commentedPatch in #20 works as advertised. Marking as RTBC.
Comment #23
damien_vancouver commented+1 for Patch #20 working properly
Comment #24
JanKanis commentedI've created a module here that solves this issue for me. In my case the above patch applied all the same visibilities and permissions to unpublished content rather than just making it visible to their owner.
Comment #25
albert volkman commented*bump*
Comment #26
ashlinry commentedHey! I just ran into this issue myself. I'm wondering if this patch is making its way into the next release.
Comment #28
gisleThis is fixed in 7.x-1.x-dev.