[development] deny user #1

Alan Dixon alan.g.dixon at gmail.com
Wed Sep 13 16:59:33 UTC 2006


okay, i read the code and it says that menu item paths should be
unique, so this solution isn't good. I think if your module's name
started with a letter after n, this might work if you put it in the
non-cached section.

But another option would be to create a simple page that says 'you're
not allowed to edit this item', and generate a bunch of aliases that
point all the node/nid/edit paths to it. I've used this technique
before (overriding module defined paths with an alias to change their
behaviour) and it worked, though I've never heard of anyone else
recommending it. Any opinions on this technique?

On 9/13/06, Alan Dixon <alan.g.dixon at gmail.com> wrote:
> another approach might be to intercept it earlier. Since the list of
> nodes that you can't edit are fixed after the import, in your
> hook_menu of the module you could add something like:
>
> foreach($imported_node_ids as $nid) {
>   $items[] = array('path' => 'node/'. $nid .'/edit', 'title' => t('edit'),
>           'callback' => 'node_page_edit',
>           'callback arguments' => array($node),
>           'access' => FALSE,
>           'weight' => 1,
>           'type' => MENU_LOCAL_TASK);
>  }
> }
>
> But i'm not sure if that would work, or if it should be in the cached
> or non-cached section (how does drupal negotiate conflicting menu
> definitions? yes, i should rtfm or at least the code...).

-- 
Alan Dixon, Web Developer
http://alan.g.dixon.googlepages.com/


More information about the development mailing list