I'm not sure if this is a bug or just a shortcoming of the design.
Most of my users are subscribed to content-type Forum Topic, and hence get notifications of all forum posts as intended.
However, I have one forum that has limited visibility to a specific role, managed by the forum-access module. But updates in this forum are emailed to all users on the basis of content-type. So users are getting notifications about posts they can't access.
I thought Subscriptions was supposed to take account of user access, but it's not doing so in this case.
Can someone tell me if this is a bug, or is it working as designed? If it's a bug, any idea where the problem lies? I've been looking at the subscriptions_queue() function, which AFAICT is where all the user notifications are built, but I haven't quite deciphered it yet - it seems to build a massive SQL statement.
Thanks
Comments
Comment #2
salvisSorry for not replying sooner. This should not happen. I'm using Subscriptions and Forum Access extensively, and I don't see this. Are you sure that the receivers of the notifications don't have access to those nodes?
Comment #3
rickj commentedHi salvis, thanks for replying.
I tried opening one of the forum posts as a regular user that had received an email, and it was access-denied. I also have simple-access installed, but no simple-access restrictions are in place on forum topics so there shouldn't be any conflict.
All forum topics are publicly accessible at the content-type level, it's only forum-access that controls visibility.
Now I know it's supposed to work I'll set up a testing configuration so I can run thorough tests without risking spamming the users! I'll report back.
Comment #4
salvisI'm very interested in seeing what you find.
Have you installed Devel Node Access (in Devel)? It's two blocks give you insight into your Node Access setup.
Comment #5
rickj commentedThis definitely doesn't work correctly. I did the following:
(The Forum Topic content type is publicly visible in its own right, access is only restricted by forum category)
The result was a notification sent to the test user. Clicking on the link in the email, and logging into the web page as the test user gave an Access Denied error.
I've installed Devel Node Access, and everything it tells me looks correct. Subscriptions behaves as if the access check is only checking the content-type access, not the category access.
Any thoughts?
Comment #6
rickj commentedHmm, I thought I'd try rebuilding permissions. I've always previously done it when requested, last time was probably when I installed forum-access.
Following this, notifications seem to be working correctly! On adding a comment to the test post, the notification is queued, but not sent, which I presume is when the user access check takes place.
Should have done this before, sorry for the distraction.
One other query though, when I run the Node-access Summary (from devel-node-access) it tells me under Legacy Nodes "You have 3 nodes in your node table which are not represented in your node_access table" etc. How can I find which nodes these are, and does it matter? I still haven't got my head around exactly how Drupal's permissions work.
Thanks
Comment #7
salvisWell, I'm glad you've been able to clear this up.
DNA would have told you that the permissions of the node in question need to be rebuilt.
Also, on admin/config/system/subscriptions you can turn on
and you'll get messages like
and
as well as one or more messages for each sent notification in the watchdog log.
These nodes won't be accessible by anyone but user 1. Rebuilding permissions should cure this problem, otherwise you have a buggy node access module installed.
Comment #8
salvisComment #9
salvisComment #10
rickj commentedHi, thanks for the comments
I didn't investigate DNA much before deciding to try the permissions rebuild. However, I did notice it said "1 node not represented in the nod-access table" initially, That went up to 3 after the rebuild. Maybe I should run another rebuild. It would be nice to know what nodes it refers to.
I'd also tried out the debug options, but found it produced too many entries to be useful. I've since decided I like to get logs of unsent notifications, but to skip successful ones, so I've commented out those lines of code and left the debug option on.
Comment #11
salvisThat's not good. It should always be 0.
You'll have to use SQL (e.g. phpMyAdmin) to find out which nodes are missing. And then DNA's Debug Mode to check them.
You have to look at a single node only. If you have "too many entries," that's because your Node Access configuration is overloaded, and examining them carefully is even more important than if you had only a few.