How to set permissions of creating content only for referenced users I have 2 content types: Courses and Documents. In Documents there is a node reference field which connects it to Courses (actually with a Node Reference URL Widget). In Courses there is a user reference field. 

I'd like to add permission of Document content creation only the user who is referenced in Courses. Is it possible somehow? I tried it with Node access user reference modul (it has a "Grants for referenced users to create content" option) but it adds the create permission in every Course content, not only in that he/she is referenced.
If you are using the Node Reference URL Widget to add the create link then you could use panels (with the built in context) to hide that link if the user is not referenced on that node. This would not stop people from going to the url directly but would keep the honest people from creating content on nodes that they are not referenced on.

If you need a more secure way to prevent the creation of the document nodes I assume you would need to write some code or do some rules magic.

Rules magic idea: Create a flag that is hidden like I mentioned above. When the node is flagged then if the user reference is the current user then create the node and go to the edit page(and unflag when done). If not then unflag and show a message.