Closed (fixed)
Project:
Node Reference URL Widget
Version:
6.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2010 at 15:39 UTC
Updated:
9 Oct 2010 at 15:45 UTC
There are currently few node access options, but i would like to have option to limit CREATION of node only if user has option to edit referenced node. So it would be some sort of crationg/edit node access option, is it possible to somehow set it up or does module need upgrade for this?
Comments
Comment #1
Marko B commentedJust realized this are options of this module http://drupal.org/project/nodeaccess_nodereference and doesnt have to do with this module. sorry
Comment #2
quicksketchThanks for the update. This question has been asked before and it is out of scope for this module. This module is a convenience, it doesn't provide any sort of access control. That said it does check existing node access control before showing the link to create new content, so if you have a node access system in place that enforces this sort of behavior, Node Reference URL Widget will obey it.
Comment #3
Marko B commentedYes but it will only enforce access to node type that you create, it wont check is the creator also owner of node which is referenced. And i would like option that if you are logged as one user you can make new nodes referenced to only the nodes or node that you are owner and currently i can make to any node of type. This cannot be done, right?
Comment #4
yellek commentedIt would be possible to do something like this if there was some sort of hook built in to the permission check that the module does before putting the link up. My current thought for a solution is to use module weights and create a module that runs after node reference URL, looks for the links and removes them. Very clunky.
Is there a possibility of calling a rule or some other way of doing this?
Comment #5
quicksketchThis module already calls a hook through the node_access system (hook_node_access()). If you'd like to hide the link, you should implement a real access control system so that users can't just type in the URL directly.
Comment #6
quicksketchIf necessary we could add a property to the node (like $node->node_reference_candidate) to indicate what NID was about to be referenced and then hook_node_access() would provide enough information to deny the creation of a new node.
Comment #7
yellek commentedI've been having a think about this and it would certainly be possible to put together a little module that does this using hook_link_alter(). I need to do it for a site that I'm doing at the moment however I don't have the cycles to spare to do the legwork of formally supporting it here. If there was someone who would be willing to take on the maintenance of such a module I would be happy to contribute.
Comment #8
yellek commentedJust a quick update to say that I have a module working that does this. I have appended the code below in case anyone needs it:
Comment #9
johnpitcairn commentedSubscribing for future reference, thanks.
Comment #10
babycourageous commentedsubscribing
Comment #12
Marko B commented@Yellek
how is this working? should i just add this code to this module and install http://drupal.org/project/nodeaccess_nodereference ?