Closed (fixed)
Project:
Node access user reference
Version:
6.x-2.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 May 2009 at 21:08 UTC
Updated:
4 Dec 2009 at 07:30 UTC
Jump to comment: Most recent
Comments
Comment #1
danielb commentedI do not think this module is the place for such a thing. If anything, it should be Drupal's node access system to implement this feature. Anything you can do here with drupal_alter could be done just by doing what this module already does - checking form submission values and providing node access hooks.
What do you need this for? I would like to see more discussion on this.
Comment #2
meba commentedFirst, I have taken this feature from Organic Groups, it's implemented the same way in og_access. Second - it's really important to mention how Drupal 6 node access system works: Once access is allowed, nothing can deny it.
Now what exactly I need - I am referencing users in the node to allow access. But if the workflow state (Workflow module) of the node is "expired", I need to disallow access no matter that users are referenced.
Using a current system, I can't create own module and disallow access if workflow state == expired. NAUR will still allow it -> access is allowed. That's why I need to alter the grants. I am succesfully using the same feature from OG and it works flawlesly.
Drupal will never support such thing in current versions. I am happy to post a solution for Drupal 7, but 6.x and 5.x are not accepting modifications except bugfixes. That's why I would like to see this patch in. We can remove it for Drupal 7 later.
Comment #3
meba commentedMy implementation:
Comment #4
danielb commentedOK well if OG provides this, then at least there is some precedent for it, and I won't feel as awkward doing it.
The ideal solution would be to use db_rewrite_sql in the same way the node access system does to add some joins/wheres for the workflow condition - but this is probably rather difficult.
In Drupal 7 the database layer will provide a hook_query_alter which has been recommended for use as an alternative to using node access.
I will get around to committing this when I can.
Comment #5
danielb commentedThere also another drupal 7 issue of interest here http://drupal.org/node/309007
Comment #6
meba commentedExactly. Once this lands in D7, this patch won't be needed. But for D6, we have no other way :( Thanks for considering including it, it might help others and will help my new site free of patches.
Comment #7
meba commentedDaniel, did you have time to look commit this issue? Is there anything I can do to help? Let me know, thanks!
Comment #8
danielb commentedI've made a new release just for this.
Comment #10
hefox commentedWas looking At the new release to see what has changed and saw this.
It is possible to alter grants outside of having a hook in the module since grants have priority. Simply get all the grants (I use static), alter at will, return with a higher priority. I made a module for this, but haven't released it since it was for a client, but it's how I combined for a project using og_access, workflow_access, this module, and a custom module.
Ah, too late but all well.
Comment #11
Anonymous (not verified) commentedhefox, I'm desperately trying to find a way to combine og_access and workflow_access and came across your post. Do you have an example of what you mean by "Simply get all the grants (I use static), alter at will, return with a higher priority."? Many thanks!