I really hope it is just a setting that I am not aware of because I need this to work. It not, this seems to be a big bug. This is the situation.
I am running D6.10. I have core permissions set so that anonymous can view content. I enabled content_access and set the story content type so that anonymous cannot do anything. I set the advanced value to -10 to override the core permissions (0 and 1 didn't work). I have run cron and cleared performance cache. I went to a fresh browser (no browser cache for this site).
While on the site as anonymous, I click on a story node title from a View. The link took me to the full node view versus being denied access (as I assume it should). I went straight to the story node via url, it still showed the full node.
I tried setting the core permissions so that anonymous cannot view any content (assuming I would override one content type at a time) but then the Content Access management screen can't override this setting. The anonymous check box is disabled.
It is very important that I get this working. Please help.
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | devel_node_access.529772.29.patch | 12.49 KB | salvis |
| #25 | content_access_node17_adminview.jpg | 110.49 KB | idcm |
| #24 | ca_default.png | 8.89 KB | salvis |
| #19 | content_access_table_rebuild.jpg | 108.04 KB | idcm |
| #19 | content_access_storynode17.jpg | 101.51 KB | idcm |
Comments
Comment #1
salvisYou should start by following the procedure that is displayed when you click on http://drupal.org/node/add/project-issue/forum_access — don't create a new issue in the FA queue though, just follow that procedure and report here...
EDIT: This started out as an issue about Content Access showing nodes to Anonymous when it shouldn't, but it evolved more and more into a discussion about Devel Node Access and it has already lead to various improvements of DNA. As of #26 I'm moving this issue to the Devel queue, because we're now dealing with a case of DNA claiming that Anonymous should have access when he hasn't.
Comment #2
idcm commented1. update to the "recommended" - already there
2. check dev notes - nothing there to indicate if this issue was addressed in latest dev
3. done
4. the DNA reports what I said. Anonymous can see it even though content access for the story content type is not set to view.
username view update delete
admin1 yes yes yes
Anonymous yes no no
5. the feedback doesn't tell me much. It just says I have some nodes that are not in the table yet. the nodes that is in question was in the node access table. GID value 4 and 5 (two records). Other records are set to a GID of 2 and I can see them (even though I shouldn't).
What is the GID? What do the values represent?
So ... back to my original question - Why do I still see all nodes that have been flagged as not accessible by anonymous?
Comment #3
salvisWhat is your problem? You post a reply with
and then you go back and erase the text?
I wasn't being rude in the least and I was fully aware of where you posted — I merely pointed you in the direction that would quickly lead to a useful discussion. It might even enable you to solve the problem yourself.
Since you marked this as critical, it seemed to make sense to try to help you...
Maybe YOU should "try thinking before spatting off," and you owe me an apology.
Comment #4
idcm commentedI apologize, I miss mistook the tone of your message as someone who was ticked off that I didn't follow some instructions that I haven't even seen before. After I cooled off I decided I realized maybe you didn't mean it to sound that way so I took it back. Thanks for making sure my mistake is available for every to see.
Meanwhile, I did everything you asked but can't figure out why it isn't working. To me it is critical and I suppose if it is happening to someone else, they would feel the same. Your challenge that I should diagnose my own problem felt like a hint that it was my own error and you wanted me to figure it out on my own. So I thought I should down grade the issue.
I am sorry I offended you but the tone of your post felt like a slap in the face.
Comment #5
salvis(Comments are not just displayed here, but they are distributed immediately by email to everyone who is subscribed. IOW, editing does not undo posts.)
No, I'm not implying that it is your error (nor that it really is a bug), but in this area it's just about impossible to get a clear picture from what you (or anyone) writes in prose. Node Access is very complex and without DNA neither you nor anyone else can begin to guess what is happening on your system. Prose is simply a waste of time.
With DNA's debug mode we can see the full node access data for one specific node, and then we can begin to discuss what we see. Please post the full table, there's valuable information in every row and every column. Or even better, attach a screen snapshot of the table.
The meaning of the gid depends on the realm. Post the full information and your chances for getting help increase dramatically...
Comment #6
idcm commentedI have attached are three images: DNA, Summary, and the db table. Please let me know if there are any other reports that will help.
thanks
c
Comment #7
salvisReset priority to 0. You shouldn't change that unless you have more than one node access module and you want to try to prioritize among them.
I don't understand what you mean with
In what way did 0 work less than -10?
DNA says that CA grants read access to roles 4 and 5 (moderator and admin) to node 17. There are no inconsistencies as far as node 17 is concerned, and there's nothing that would grant access to Anonymous, yet at the bottom we see that he has read access!
Also, no role should have update nor delete access according to the first table, yet there are a couple of 'yes' entries in the second! Weird...
Now show us content_access_DNA.jpg as seen by a moderator and by an anonymous user.
It's 2:45am here — I'll check in again after getting some sleep...
Comment #8
idcm commentedthank you for staying up so late.
When I started trying to get this to work, the priority was at 0. When it didn't work, I saw "If you are only using this access control module, you can safely ignore this. If you are using multiple access control modules you can adjust the priority of this module." I thought maybe this was the issue. I don't have any other control modules running except core but it was worth a try. I set it to be -10 because in Drupal, -10 means at the top, first, etc.
Attached are three more images: the story access control settings (just in case), the DNA for mod and anon.
thank you
c
Comment #9
salvisAh, so you're confirming that setting priority to -10 hasn't helped over leaving it at 0, right? That would have been most surprising.
Thank you for the additional snapshots. So, admin and moderator both have administer nodes. I wouldn't give it to the latter — after all you're already using CA, which can grant Edit and Delete rights.
The second table should list the reason for access rather than just 'yes', that would be much more helpful. (I happen to be the maintainer of DNA, although not the author of the second table.)
The reason for the unwanted access seems to be the 0/0/all/100 record in the {node_access} table. That's what "Access Granted to All Nodes (All Users)" on the NA Summary is trying to say. If you delete that record, things will probably be close to normal. However, several questions are open, like why is that record there, and as you wrote, if it gives problems to you, it's bound to cause problems for others, too, so I hope you're willing to explore this further rather than aiming for a quick exit...
Now verify that users without administer nodes cannot see the two "Legacy nodes" anymore. You'll have to set CA for their content type as well, so that they can become visible.
This is how it should work in principle. If it repeatably doesn't work that way, there's a bug in either CA or Drupal. We need to further discuss this once we have your results.
Thank you for pursuing this!
Comment #10
idcm commentedRight
I am committed to understanding.
I assume the two nodes you are referring to are nodes 21 and 23. 21 is a Drupal for Facebook Application node (do some testing with Dave). 23 is a newsletter node to test SimpleNews module.
0/0/all/100 remained (see image). I enabled CA on forum, page, story, and case study content types. There aren't any forums in there, just being thorough. The story content type won't engage in the NA table. you can see that the NIDs end with #15. hhhmm
Not sure I understand. I looked at nodes 21 and 23 as anonymous before starting the process above. Images are attached showing what I saw.
Thanks but not my theme. It is Marinelli. This is a demo site where I play with modules before giving them to clients.
I am ready for next level testing. If you want me to manually remove 0/0/all/100 next time around, that's cool.
Comment #11
idcm commentedI don't know if it makes a difference in the diagnosis process but the first time I enabled CA, I turned on the story content type first and I never did the forum content type. This time I did story it after the page, forum, and case study content types.
Comment #12
idcm commentedQuestion.
Without CA installed, if I set core permissions to not allow anonymous to view content, anonymous can still see the teaser of the node but when you click to see the rest of the node, you get access denied. This makes sense to me.
I have been assuming that CA would do the same thing. Set a content type such that anonymous cannot see the full node but anonymous can still see the teaser in a View or published to the front page or even in a taxonomy term list.
I ask this because one of my clients has a Drupal site and has CA installed (I didn't set up the site). When CA is set to not allow anonymous to see a particular content type, it removes all those content type nodes from the a teaser view. Is that what is intended with CA?
Comment #13
salvisI've been playing with CA and I'm a bit confused about what happens when I disable and enable it. It's probably better to not just disable but also to uninstall it and then start over.
What I wrote in #9.2 is not correct. Enabling CA should not result in an empty {na} table (as I wrote) but in a table that has one NID/0/all/100 record for each node. And the 0/0/all/100 record must be gone.
What you show in content_access_table_CAturnedbackon.jpg is bad, but I was unable to reproduce it. The 0/0/all/100 record causes all nodes to be visible to everyone. This makes all other records ineffective as far as View is concerned. Enabling any node access module should replace the one 0/0/all/100 record with NID/0/all/100 records, one for each node. The resulting behavior at this point is the same, but from then on, each node can be controlled separately, without any side effects on any other nodes.
But not having any record for some nodes is bad, too, because these would disappear (if it weren't for that bogus 0/0/all/100 record). What does DNA show you for the story nodes?
NID/0/all/100 (the Drupal default) corresponds to CA's default of access to anon and auth. If you change a content type, CA does the following for each node of that type: it replaces the one NID/0/all/100 record with one or more NID/RID/content_access_rid/100 records, one for each role that you have given View permission.
This was based on the assumption that you'd have removed the 0/0/all/100 record. If it's still there, everyone can still see those nodes, of course. Don't they have any DNA information?
First really do disable and uninstall CA and then reenable it. Is 0/0/all/100 still there?
If yes, then try something else: uninstall CA and install ACL (just for testing). This should produce the same set of NID/0/all/100 records and no 0/0/all/100. Does it?
This test should tell us whether we're dealing with a CA problem or with a CA-independent NA problem...
You mean access content? I thought should not see teasers, not even titles, but I'm not really sure. IAC you should give access content and let NA control it.
NO, not at all. If NA is active then users who don't have View cannot see any trace of the nodes in question. At least that's how it should work. There are buggy modules out there that don't properly enforce NA, and those can leak parts of or even entire nodes, but that's not how it's supposed to work.
Yes, that's how all NA modules are supposed to work!
Comment #14
idcm commentedBefore I do all of the above, I see in the DNA (that I forgot to look at after re-enabling CA) that I need to rebuild permissions. See attached. What order do you recommend? rebuild first?
Comment #15
salvisJust for the sake of completeness, you do see the messages from Drupal that ask you to rebuild permissions sometimes, don't you? And you do the rebuilding when requested, right?
Start by uninstalling CA. You'll be left with one entry in {na} and a clean slate.
Comment #16
salvisOh, and BTW, I've updated DNA so that it detects and reports that unexpected 0/0/all/100 record. It's not flagged as an error though, only as a warning, because it's possible that someone would actually want to have it that way. But they'd have to go out of their way to do it.
The update will be in Devel 6.x-1.x-dev after it has been repackaged (within 12h).
Comment #17
idcm commentedI have only ever seen them once but don't recall when which site it was on or what caused it. I did do the rebuild when asked. In this case, I didn't notice the rebuild request because I forgot to look at the DNA. I am used to messages appearing above the content area.
Okay, I have uninstalled CA. DNA does not show a request to rebuild anymore. 0/0/all/100 is still in the NA table.
I just installed ACL and the NA table remained unchanged. Given ACL is an API I assume there isn't anything to do but install. So maybe this isn't a CA issue? I hate it when this happens.
Comment #18
salvisThe rebuild permissions requests from Drupal (in the message area) and from DNA (in the DNA block) are two different things. Certain events inside Drupal cause Drupal to realize that it must rebuild permissions, and that's when it flashes that message. OTOH, the DNA message comes up when DNA finds inconsistencies between the {na} table and the information that the modules would return to Drupal if Drupal were to rebuild the permissions. Drupal would never find these inconsistencies on its own and would just limp along with whatever data is in {na}.
Correct. It seems like something on your site is trying to optimize NA and keeping Drupal from exploding the 0/0/all/100 into NID/0/all/100s.
Even though you can't interact directly with ACL, Drupal recognizes it as an NA module and behaves accordingly. I think Drupal should ask you to rebuild permissions after you've enabled ACL (or any other NA module).
Comment #19
idcm commentedI just re-installed AC to trigger the rebuild link (couldn't recall the path). I rebuilt, made the page content type not viewable to anonymous and it worked. Attached are three images. DNA doesn't show up for anonymous but attached is what I see as admin. Also the NA table and list of modules I am using.
Do you think all is working correctly? I ask because DNA shows anonymous should be able to view node 17 when it actually can't.
In the meantime, I want to thank you for all your attention and help. The sad thing about all this is how AC was designed to work. I assumed it would behave like core permissions but simply at the content type level. We need anonymous to see some content types and only the teaser of other content types but as you know, core is all or nothing. Unless you have an idea, I think we are back to the drawing board. We are trying to avoid custom coding.
I look forward to your ideas.
c
Comment #20
salvisYes, now it looks good.
The 'yes' for Anonymous is odd, but what exactly is 'Anonymous'? I don't see it here. Is it an account that you have created and called 'Anonymous'? If that's the case, then 'Anonymous' is an authenticated user, not an anonymous one! If you want to 'impersonate' an anonymous user, you have to log out.
You're welcome. You have highlighted a very important possible glitch that the first DNA block didn't catch so far. I've implemented it now, and this is a great improvement for DNA, which will ultimately help with support for all NA modules. So I got something out of it, too, and I appreciate your perseverance in testing and posting updates.
The all-or-nothing property is not a feature of CA but of the node access mechanism in core. This mechanism does rely on the cooperation of every module that displays lists of nodes though: the module must feed its queries through db_rewrite_sql(). Modules that don't do that are considered buggy, but if you find a module that presents the list as you want it, you can simply remove that db_rewrite_sql() call, and you get all nodes. Clicking on a read-more link will go to an error page though.
You may also want to look at the Premium module. Maybe it does what you want.
Comment #21
idcm commentedAnonymous is Drupal's default role for unregistered users - so the yes status kinda thru me. If it is something in DNA and you want some more testing, let me know.
On that note, if you need more testing, please don't hesitate to use the DO contact form and send me a message. I am not a coder so I try to make myself available for documentation and testing as a way to give back.
I looked at Premium and the description sounds exactly what we want. I sent the developer a message asking how I could help bring it out of dev status and into recommended.
Thanks for the info for db_rewrite_sql(). I will pass it along to our developers and see if it is something we want to try.
Comment #22
salvisAh, yes, now I see it too. I have 10 accounts on my test system and Anonymous as the eleventh wasn't showing. :-) I'll look into it.
Thank you for your offer to do testing! Besides DNA I maintain Forum Access, Image Gallery Access, ACL, and Subscriptions. Do you have any interest in any of those?
Comment #23
idcm commentedYes. Drop me an email when you need help. I also Skype if you want to chat.
thanks
Comment #24
salvisI've looked into why Anonymous might have read access, and it just doesn't fit together...
What I see here is that if CA is installed and we're looking at a content type that hasn't been configured, then that content type defaults to read access for anonymous and authenticated. DNA shows this as in ca_default (the second row). However, you're not showing such a NID/0/all/100 record in the DNA snapshot nor in the {na} table.
Could it be that Anonymous is the author of node/17 and might have access because of that?
What do you see when you log out and look at node/17? Can you really view it? What does DNA say about why you can see it?
Comment #25
idcm commentedhi
sorry for the delay in replying. How can i get email notices when someone posted on one of my issues?
anyway, admin1 created node/17. If I try node/17 as anonymous, I get the contact form (as it designed because i set "access denied" to redirect to /contact.
If I try node/17 as admin1, i get what we saw before. see image attached.
Comment #26
salvisNo problem. To get email, click on the "Issues" link in the breadcrumbs at the top of the page, and then "Subscribe".
This has grown out of scope for CA and I'm moving it to the Devel queue.
There has been an effort in #309765: More info for why user is allowed/denied access to essentially duplicate the code from node.module to be able to tell why access is granted, but this got stuck along the way. We now have a case of DNA claiming Anonymous has View access (as returned from
node_access()!), yet Anonymous gets access denied. So, even though I'm not very fond of that code duplication, we now need the result.I'll come up with a patch. You do know how to apply patches, idcm, right?
Comment #27
idcm commentedlol, believe it or not but the last "patch" I did was in D4.5 and I had to manually copy/paste the new code. If that is what you mean by patch, yes. As long as I know what file is being changed. If not, then I will need some coaching.
c
Comment #28
salvisSorry about taking so long. I was hoping we could fix a bug in core (#470840: Bug in node_access if we specify an account when check the filter_access), which would have made this task easier.
Anyway, here's the patch. The instructions for applying patches are on http://drupal.org/patch/apply.
I hope this will give us a clue as to why Anonymous can't see that node. If it doesn't, I'll have to work on it some more...
Comment #29
salvisAh, here's the patch.
Comment #30
salvisActually, I committed this after the favorable feedback I got in #559522-2: DNA shows different update permission depending on sign in a while ago. In the meantime I've tuned it some more and ported it to D7, too.
Comment #31
idcm commentedThank you. We went with premium but now it looks like we may need to add node_access in as well. Good timing.