I have a simple photo gallery setup where there are two content types - Event and Photo. The Photo type has a nodereference back to the Event to which it belongs. Instead of setting access rules on each photo, I want to set it on a per-Event basis, so I thought this module would fit perfectly.
I'm not a Drupal veteran, but more of an advanced newb -- maybe this is beyond me, but this just flat out isn't working when I try to use content_access to control access. I've placed the priority for nodeaccess_nodereference at -5 to make sure, but I still can't get it to work.
Does anyone have any tips? If this module doesn't work with content_access, what is the recommended module to use?
Comments
Comment #1
justintime commentedSo I disabled content_access, and went with nodeaccess, and get the same results. Did I misunderstand what this module does? Perhaps it only looks up the core role-based permissions only, instead of actually calling through to other *_access modules? If that's the case, does such a module exist?
Comment #2
justintime commentedA few more details. Things aren't broken, they just aren't working right ;-). I've found two issues that prevent this module from working fully with content_access:
Note that in order for this to work for me, I had to set content_access' priority to 0, and set na_nr's priority to 5.
So, I think these may actually be bugs or features. I'm just cutting my teeth on Drupal development, and from what I read node access is one of the tougher areas. I have to have this working though, so I'm going to see if I can get this working. If I do, I'll submit a patch back to you. However, if you have the time, I would greatly appreciate any assistance.
Comment #3
danielb commentedSince this module is so damn complex my memory might not be entirely correct, but here goes...
To update access on a node, that node must be saved, or have it's permissions rebuilt. If you save one node, and expect it to affect another node, that wont' happen, until that node is also saved or rebuilt.
Now this module does attempt to rebuild possibly affected nodes even before the admin manually rebuilds, but only a few at a time, so it may take a few page loads to actually propagate it through.
Just having a quick look through the code it does appear as through there are a couple places that deliberately avoid taking action on anonymous users - this might be carried over from the module this module was based on (Node Access User Reference), it may be there for a reason, it may be a bug, I really can't remember.
Comment #4
danielb commentedComment #5
danielb commentedComment #6
danielb commentedThis module is changing significantly and this issue may no longer apply in future
Comment #8
stefan81 commentedHi, first of all I would like to thank you for the great module!
Interestingly, node_access works inside blocks,
for example to define the block display.
How ever it does not work from within the a node template.
Am I missing something?
I called also global $user beforehand, with no result.
I made a dsm call on node_access.
It appears to be empty, so no value is returned.
I am using the node reference permission via a user reference on a certain node.
So for the moment I made a workaround with a custom function checking the user reference field, giving the initial permission.
But I would like to understand this problem.
Best regards
Stefan
Comment #9
danielb commentedI fail to see why you posted that here. Start a new issue, and show examples of your code as you are very bad at explaining it.