Closed (fixed)
Project:
Nodeaccess
Version:
6.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Dec 2008 at 20:57 UTC
Updated:
13 Dec 2011 at 20:22 UTC
Jump to comment: Most recent
Comments
Comment #1
johnhanley commentedI should add that changing the perms via a query in hook_nodeapi is easy. I am specifically asking for info on how best to go about it with nodeaccess enabled.
Comment #2
Anonymous (not verified) commentedYou can't do that using the core drupal access functionality, drupal will grant permission as long as there is at least one nodeaccess permission that grants it. To do this you would need to either programatically remove their permission once a condition is met (i.e. delete it from the tables as nodeaccess does) or create another module and do what you need to do there to override it.
Comment #3
johnhanley commentedOk, thanks for the confirmation. I've actually got it working.
Update: Oops, spoke too soon. See below.
Comment #4
johnhanley commentedHmm... The permissions in table nodeaccess aren't being enforced.
UPDATE nodeaccess SET grant_update = 0 WHERE nid = 1 AND gid = 3
Record is correctly updated (grant_update = 0) yet the user is allowed to edit the node.
Does the author have edit access to their own node no matter what?
Comment #5
Anonymous (not verified) commentedIf drupal's core permissions allow someone to edit something, then access control modules are not consulted.
Comment #6
magoo commentedMy two cents:
Why is it then possible to configure the author permission in the nodeaccess module? If it is not consulted...
btw, the question does not concern this module in particular but it is still unanswered.
There is, however, a hack possible (just though about it and need to test it) :
in a module:
The result is that Drupal will not enable the edition of a node where the filter value has been set to an unauthorized value.
Comment #7
magoo commentedI finally got time to do this:
in a module (workflow is the name of my module, change it to suite your needs):
All this creates an input format of substitution (no role should be allowed to use that format).
I copied the filters associated with the existing format 1 in case it is needed.
Users member of a role having the 'edit locked content' will be able to edit the content.
You must tailor the CONDITION to your needs.
Comment #8
eelkeblokI've tried taking this approach, but unfortunately it has one big caveat. I think it might have been because I did a clear cache between implementing the lock and actually viewing the node I had locked again (not on purpose, it just turned out like that), but I ended up with the node showing its raw input, i.e. no input filters had run. This solution relies on the rendered output being available, because if it isn't, and the input filter is changed at node load, rendering the output will not work, for obvious reasons.
Edit: actually, it seems the content is rendered every time. So, for this to work, it seems the input format needs to be identical to the one it is replacing, except for who is allowed to use it.