I have already reported this problem on the node privacy by role page as it has the same issue.

I have built a site with several basic pages and several views pages. I am trying to use this module to restrict access to one of the basic pages. Unfortunately it seems to partially restrict access to my views pages as well. Anonymous users can only see the first page of results on all the views pages. They cant see the pager and therefore cant get to the next pages.

I am quite new to Drupal, so this could be something i have done wrong, but I am quite sure it's not.

Please, if anyone can help me it would be much appreciated.

Rory

CommentFileSizeAuthor
#22 taxonomy-view.txt5.91 KBkarilu_ec
#19 view.txt6.34 KBkarilu_ec
#16 no-show.jpg31.17 KBenrikito
#16 show.jpg31.43 KBenrikito
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Waldknoblauch’s picture

I habe the same problem with views ...

aocoder’s picture

I'm having a similar issue in 7.x. Right now, I have content access set to allow access to nodes for any user. This works fine, and anonymous users are able to access any of this content. However, I have a view that lists these nodes, and this view is empty for anonymous users.

SNaKeMe’s picture

Same here.

BenK’s picture

Subscribing

good_man’s picture

Issue tags: -views, -issue, -Content access +#views

related issue IMO #1057400: Taxonomy access tried to figure out where this bug occurs, unfortunately couldn't, seems I'm so sleepy, will try later.

good_man’s picture

Issue tags: -#views +Release blocker, +views

correcting the tags.

SNaKeMe’s picture

The error occurs only when the pager is used. If Views is set to display all the items then the guest also see each element. Seems to be an error of views.

chrisgross’s picture

I don't see how this is a problem with views. Here is my problem:

Before this module is installed, views works just fine. Before making any changes to permissions, views works fine. After changing content type access permissions, content is duplicated. After removing content type access permissions, content is still duplicated and can't be reverted.

commanderflash’s picture

I am having the same issue. Unfortunately I am finding lots of bugs with the latest version of views related to contextual taxonomy filters. I do agree that it appears to to be an issue with this module though. If you disable it, the issue goes away.

bryrock’s picture

same issue as #2.

enrikito’s picture

same issue as #2 and #7

related? http://drupal.org/node/1094414

good_man’s picture

I can't seem to reproduce it, please list the steps you did + the versions you used + test it on fresh Drupal installation.

@commanderflash: I'm hopping that [#1192196] will solve the issues with taxonomy.

BenK’s picture

I also tried to reproduce this, but everything seems to work fine for me. Can someone who previously reported the error post steps to recreate?

I don't doubt there's a problem and I'd love to help find a fix today. The faster you list steps to reproduce, the faster it can be fixed! ;-)

--Ben

enrikito’s picture

Default core modules 7.0

Content Access 7.x-1.x-dev
Chaos tools 7.x-1.0-alpha4
Views 7.x-3.0-beta3

- Create any taxonomy term
- Create 11 nodes, or more, and asign taxonomy term
- In Views, enable "Taxonomy term page"

If enable pager in View Taxonomy term, * anonymous user no show the content in taxonomy/term/%

(*) No "Bypass content access control" permission user

good_man’s picture

Thanks for the explanation, so I can understand that all who are affected by this bug used the taxonomy page? because there is a related issue here #1057400: Taxonomy access. If anyone has a similar bug without using taxonomy please report it here, otherwise we have to wait for that issue to be fixed.

enrikito’s picture

FileSize
31.43 KB
31.17 KB

...

If change order of "Contextual filters" in View Taxonomy term, the content is shown.

BenK’s picture

@enrikito: Thanks for posting your configuration. Can you try to upgrade your CTools and Views to the latest -dev versions of each and see if the problem persists? You're using older versions of CTools and Views and there have been a lot of bug fixes since then.

We should just rule that out first....

Thanks,
Ben

enrikito’s picture

same behavior with:

Chaos tools 7.x-1.0-beta1
Views 7.x-3.0-rc1

* Reorder Contextual filters fixes the problem (temporarily)

karilu_ec’s picture

Issue tags: -Release blocker, -views
FileSize
6.34 KB

I run into the same issue as well. I have Drupal 7.1 with only Views 7.x-3.0-rc1, CTools 7.x-1.0-beta1 and Content Access 7.x-1.x-dev enabled. For testing purposes, I don't have any restrictions for the content types. When module content access is enabled the anonymous user cannot see the view with the taxonomy terms as contextual filters. If content access is disabled the view behave as expected.
I am attaching the view export. Is this still related to #1057400: Taxonomy access and some bug in the core as mentioned in one of the comments? the reordering of contextual filters didn't solve my problem. I have a hierarchy taxonomy vocabulary

good_man’s picture

Issue tags: +Release blocker, +views

Please don't remove the tags. I'm working hard to solve this problem very soon. Please stay tuned :)

good_man’s picture

Status: Active » Needs review

Okay guys, now Drupal 7.3 & 7.4 fixed that issue in core, I need you to retest, this bug now should be gone forever :)

karilu_ec’s picture

FileSize
5.91 KB

I am still having the same issues.
Drupal 7.4
Only modules enabled:
Views 7.x-3.0-rc1
Content access 7.x-1.x-dev (2011-Jun-25)
Chaos Tools Suite 7.x-1.0-beta1

I have a view that takes as contextual filters the taxonomy term with (depth). Only admin can see the view results but anonymous users only see the title and pager. If I disable content_access, the view behaves as expected both the admin and anonymous users can see the results.

good_man’s picture

@kaeilu: I can't reproduce, can you please try with a fresh installation of Drupal 7.3 or 7.4 and content access? also if the issue is still, provide me with more info like:
- What the expected behavior? and what is the buggy behavior you faced?
- How to reproduce. not just the view export, but also the steps you made so I can reproduce it on my machine and check the bug.

karilu_ec’s picture

@good_man
I have Drupal 7.4, with only 3 modules enabled: Views 7.x-3.0-rc1, Content access 7.x-1.x-dev (2011-Jun-25), Chaos Tools Suite 7.x-1.0-beta1.

I created a taxonomy vocabulary with hierarchy like:
Vocabulary: Fruit
Terms: Sweet
-Grapes
-Strawberry

I added a field for my taxonomy vocabulary "Fruit" in the "Basic Page" content type. I added 5 pages that belong to grapes, and 4 pages that belong to strawberries. I am not restricting Content access for the Basic pages content type. So anonymous can view any content, as the authenticated user and administrator.

I then cloned the taxonomy term view, as later I want to create a variant for the taxonomy page.
In my view I changed the depth of the contextual filter Has taxonomy term ID (with depth) to 1, so when the contextual filter is 1 (sweet) it will retrieve all the children nodes for sweet fruit, so I am expecting the 5 pages of grape and 4 pages that belong to strawberry. If the contextual filter is 2 (grapes), it will retrieve all the nodes related to Grapes, etc.
I can see everything fine that while I am admin. However, if I see the view as an anonymous user I can't see the nodes. I just see the title of the term but not the related nodes. I set the pager to 4 items so when I see the view with contextual filter of 1 (sweet), I only see the title and the pager.
If I disable content_access. The view can be seen fine as anonymous and admin.
Let me know if you need anything else. I don't know if I am overlooking something.

good_man’s picture

I can confirm this, but when I disabled content access I still can't see anything if I'm anonymous. did you make any workarounds or steps to solve it? this will help me detect the bug faster.

good_man’s picture

Okay updating views to the latest dev (not rc1) fixed this, please update views and report back if it fixes this bug.

karilu_ec’s picture

I can confirm it. Views development version fixed it.

BenK’s picture

@karilu_ec: That's great news. Did you also have the related problem listed here http://drupal.org/node/1057400 ? Can you confirm that this problem is fixed as well?

--Ben

good_man’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

RedTop’s picture

Status: Closed (fixed) » Active

Sorry guys, issue comes up again for me. Doesn't seem to be fixed after all..

Drupal 7.12
Views 3.3
Content access 7.x-1.2-beta1 and 7.x-1.x-dev (2011-Dec-01)

Quite clearly an issue related to Content access. Disabling provides and immediate solution, re-enabling brings back the issue.

nambio’s picture

Also having this issue. Everything works fine with the module except some views seem to disappear. I'm currently testing to find out why some disappear but others do not, but the only ones which appear to disappear are those with restriction by role (a setting in place prior to content access being enabled site-wide).

EDIT: I did more troubleshooting and found the problem to be unrelated (the content was unpublished, hence only the admin view was working!). For anyone suffering a *real* problem, I would recommend rebuilding the view without any role/permission restrictions and see if that works. If it does work, then a potential workaround would be placing the public View inside an access-restricted Panel (something I was looking at doing before discovering my error).

Blooniverse’s picture

I can confirm this bug (Content Access 7.x-1.2-beta1 and Views 7.x-3.3).

csedax90’s picture

same problem, Drupal 7.14 and Views 7.x-3.3... I've tried to change permissions to views and rebuilt all but seems it doesn't work...

j4’s picture

I also have this problem. Not related to taxonomy. Not even related to contextual filters. Views which is a listing of the nodes with the fields in it, was visible before content access was switched on and is now visible only to admin, even though the user with the right content access is able to view the nodes separately.

Thanks
Jaya

trillex’s picture

I can confirm this as well with the latest dev releases of Views and Ctools. My issue is exactly as #35 is describing it.

SanFeda’s picture

I have the same problem

mansspams’s picture

Similar problem to #35. In my case I have a view that lists nodes that has entity reference field in them. With Content Access module enabled, and viewing as anonymous user, view lists only nodes in which entity reference field has value. Admin can see all nodes. It is clearly bug with permissions as only way I could get anonymous user see all view results is by granting 'Bypass content access control' to it (not cool).

dynamicdan’s picture

This may help solve the issue:

SELECT na.nid AS nid
FROM 
node_access na
WHERE (
 ( (na.gid = '0') AND (na.realm = 'all') )
 OR( (na.gid = '792') AND (na.realm = 'content_access_author') )
 OR( (na.gid = '2') AND (na.realm = 'content_access_rid') )
 OR( (na.gid = '4') AND (na.realm = 'content_access_rid') )
 OR( (na.gid = '8') AND (na.realm = 'content_access_rid') )
)
AND (na.grant_view >= '1') AND (219 = na.nid) 

The above is the (sub-query) SQL output from the View after enabling the 'admin views' settings for my test user. My content in question is deliberately unpublished but the owner should still be able to edit and access their own content (thus the 'view own unpublished content' option which is Drupal core (?).

When I save the item as published I have a valid entry in the node_access table. When not, I have no entries for the given node id.

So in short, the module is not inserting correct records into the node_access table (perhaps regardless of node access settings).

For the geeky, here's the full query un-edited:

SELECT node.nid AS nid, node.created AS node_created, 'node' AS field_data_field_profile_firstname_node_entity_type, 'node' AS field_data_field_profile_birthdate_node_entity_type
FROM 
{node} node
WHERE (( (node.uid = '792' ) )AND(( (node.type IN  ('profile')) )))AND ( EXISTS  (SELECT na.nid AS nid
FROM 
{node_access} na
WHERE (( (na.gid = '0') AND (na.realm = 'all') )OR( (na.gid = '792') AND (na.realm = 'content_access_author') )OR( (na.gid = '2') AND (na.realm = 'content_access_rid') )OR( (na.gid = '4') AND (na.realm = 'content_access_rid') )OR( (na.gid = '8') AND (na.realm = 'content_access_rid') ))AND (na.grant_view >= '1') AND (node.nid = na.nid) )) 
ORDER BY node_created DESC
LIMIT 1 OFFSET 0

Note: the initial SELECT looks bogus but doesn't seem to be a real problem.

bryrock’s picture

I did not remember stumbling into this problem over a year ago (#10), but have run into it again recently on several sites.

There is another quick work-around for this problem that does not involve disabling content access; you can select the "Disable SQL rewriting" option in the view's Query Settings, and the view will be visible to anonymous users.

JuliaKoelsch’s picture

@bryrock Thank you so much!!! You saved me a lot of time. I forgot about that setting in views.

mattsmith3’s picture

I'm having this issue too. Some views only show certain content- which is odd because I do not have the per content setting enabled. Some views show no content- which (again) is odd because I have the roles all configured per this content type. This module does not seem to be working with views for me at all.

Rhodungeon’s picture

Same problem here... I have a single content type restricted to registered users and some views using its fields. Anonymous users can't see such views if content access is enabled.

bedlam’s picture

I can confirm that #40 works. Seems definitely to be a problem related to content_access.

-- b

cobaltje’s picture

Version: 7.x-1.x-dev » 7.x-1.2-beta2

#40 - works, but every userrol can acces the view then.. and thats not supposed to.

bkosborne’s picture

Issue summary: View changes

Can anyone with the problem look at the patch here: #1225520: Add 'View own unpublished content' setting. Content Access currently doesn't support the core permission "view own unpublished content". While viewing the node directly would still work if a user had that permission, anything that lists the content (like Views or a custom query tagged with node access) will not display it. That patch should address the issue by adding a realm in the node_access table that grants access to the owner of unpublished content to view it.

fago’s picture

Status: Active » Closed (works as designed)

Conflicts with views occur probably due to the node query rewriting core pursues for us. Content access just uses the API to expose the grants. For any sql-troubles please lookup the core and or views issue queues as that's something general to all node access modules.

druderman’s picture

#40 will work for me. Then I plan to protect the View via Apache configuration.

Sinan Erdem’s picture

I believe this issue is related with a core bug explained and solved in this issue: https://www.drupal.org/node/1349080#comment-10953027

My views didnt respect content access permissions and werent showing nodes to users. After applying the patch, it is working correctly now.