Let me start off by saying I'm new to views2 and views_attach, so it's quite possible that I've just missed the proper way to configure something.
What I've done is add 2 node_content displays to a content type. The first view display is set to only allow access for anonymous, the second for authenticated users. Right now it looks like both get executed and rendered on the node page.
I did some digging, and I couldn't find a check against a user's roles anywhere, that views_attach isn't checking for this before executing and rendering. Is it as simple as if ($view->access($info['display'])) { ... } in views_attach_nodeapi()?
Thanks for any help!
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | myviewexportedhidden.txt | 17.61 KB | iantresman |
| #2 | 496838_views_attach_access.patch | 1.27 KB | kscheirer |
Comments
Comment #1
kscheirerok, In my testing when logged in as an anonymous user, I was still seeing node_attach displays that should have been assigned to authenticated roles. So I ended up with doubles - the display for an anonymous user as well as the display for an authenticated user.
adding a
if ($view->access($info['display'])) { ... }in views_attach_nodeapi() did the trick for me - users without the right access permissions are denied.Comment #2
kscheirerthis worked for me, not at all sure if this is the right place to call an access() check though.
Comment #3
eaton commentedCommitted, and also added the same code for the user/profile attachments. Thanks!
Comment #5
iantresman commentedI seem to have this exact same problem, though I am using Views 6.x-2.12 with Views Attach 6.x-2.2 (which seems to have the access code check added).
I have one View which has Access set to "Unrestricted", and the other View has Access set to a specific Role. But when I view my node as an anonymous user, both Views are shown. I can't see that I'm doing anything wrong. The node has no restrictions.
Comment #6
kscheirerare you logged in as user 1? or have the permission "access all views"? I could be wrong on the name of that permission, but there is one that will show you all views regardless of the access settings.
Comment #7
iantresman commentedDoh! It was the "Access all views" in permissions that I had set for all roles, assuming it was required to see Views. It's not, and now all fixed. Many thanks.
Comment #8
kscheirer