Hi. I don't really understand all of how Drupal permissions work, so apologies if this is from a misunderstanding.
I have the blog module installed, and I want all blog postings to be viewable by everyone and editable by no one (but the author), and no one should be able to change that. So I've set those as defaults for NPBR and then set the meta permissions to off for everyone.
But, when users create blog entries, they can't be read by anyone. I am thinking this is because their NPBR access was never set for the nodes, but NPBR is still controling access for them, and seeing no granted permissions it denies permission.
What I think the fix is, if this is really an issue, is that when a user creates a node but doesn't have meta permissions, the node needs to be created with default permissions, i.e:
function node_privacy_byrole_nodeapi
...
case 'insert':
if (!$user_has_meta_perm)
_node_privacy_byrole_set_defaults($node);
node_privacy_byrole_save_permissions($node);
break;
Comments
Comment #1
Ian Ward commentedI am experiencing the exact same issue as you describe on 4.6 and on CVS of NPBR. Also, when I check the node_access table after a blog entry is created the node is not in the node_access table. If I go in as admin to the node and resave it, it shows up in the node_access table, but when I do in as admin, all the view/edit are unchecked, as though the settings I setup in /admin/node/configure/types/blog for NPBR are ignored. Maybe it is a bug, maybe I'm missing a step or misunderstanding a step?
Comment #2
richardcanoe commentedI have the same problem, but have fixed it using the following code.
case 'insert':
if ($user_has_meta_perm) {
node_privacy_byrole_save_permissions($node);
}
else
{
_node_privacy_byrole_set_defaults($node, !$user_has_meta_perm);
node_privacy_byrole_save_permissions($node);
}
Thanks to tauberer for giving me the idea of where to start!
Comment #3
Ian Ward commentedHey guys,
I just tried this and it seems to be working great. Thanks!
Ian
Comment #4
ankur commentedMarking this as a duplicate as this issue has been resolved by a patch similar to the correction posted above. The correction posted above also needs to be applied to the 'update' case as well in function node_privacy_byrole_nodeapi(). For details, please see the related issue at http://drupal.org/node/25436
-Ankur