[drupal-devel] Working around node_access in node/add
Mark
mark at nullcraft.org
Sat Feb 12 21:30:32 UTC 2005
Ok, so redirecting back to my original issue, I'm considering 2 solutions:
1. From my hook_menu(), iterate over all existing node/add/$type paths
and replace the access parameter with one of my module's choosing. The
global $_menu variable doesn't appear to be populated yet at the time
hook_menu is called. It sets its menu items after the
module_invoke_all('menu',TRUE) gets executed. This, therefore, will not
work :(
2. Add another pass to the nodeapi hook for "access" that lets modules
restrict access to specific nodes on a situational basis. This could be
called from node_access(). I think this would address my needs.
Thoughts on another nodeapi operation?
-Mark
Mark wrote:
> Hello drupal-devel,
>
> Lately, I've been working on the Node Relativity module, and I've come
> up against some issues that I'm having trouble overcoming. The main
> thing this module does is allow parent/child relationships to exist
> between nodes. One of the features of this module is the ability to
> require that a given type of node not exist unless it is a child of an
> appropriate parent node. This works all well and good from within the
> module (except for the occasional bug), but when a user goes to the
> "create content" page (node/add), they see listed before them every
> type of node that they have permission to create. I want to limit
> this view and the menu associated with it.
> This brings me to my question: How do I override what is displayed on
> the node/add page or override the node_access permissions in general
> for node types not defined by my module? I know that node.module
> checks node_list() and calls node_access('create',$node) on each of
> the node types to see if the current user has rights to create it. I
> suspect that there's some way that I haven't seen yet that the node is
> mapped back to the module that defines it. I would like to restrict
> this view even further such that users can create these nodes, but
> only under the appropriate circumstances.
>
> Any ideas would be greatly appreciated.
>
> Thanks,
> Mark Howell
> (javanaut)
>
More information about the drupal-devel
mailing list