1

I have one content type 'object' that references one or more nodes of content type 'image'.
I'm granting access to nodes with TAC Lite: a user can view only content with a particular term.
Since the term is present only in the 'object' content type, the images referenced are not displayed in the node page.
How can I grant view access to all referenced nodes?

I've tried with Node access node reference, but it grant access to the parent node if the user has access to referenced nodes.

1

You could dynamically add the the same tag to the referenced image nodes when the 'object' node is created (or updated). To do this, you'd implement hook_nodeapi() and check the $op parameter for either "insert" or "edit" (depending on when you want this operation to happen). Then you can pull out the node id's of the 'image' nodes being referenced and apply the terms. This way they have the same taxonomy based permissions at the 'object' node.

There may be other ways, but this seems like it should work for you. I actually do the same thing to set a CCK node reference value during creation. I don't have access to a coding environment right now, or I'd add code snippets.

  • I thought about this solution. I was trying to add/remove tag to the attached images with Rules. It's a bit tricky because adding terms is easy, but removing them can create some problem (on node update I should check if no other nodes with the same term are referencing the image before removing a term). I consider this my last resource if I can't find something easier. – pasine Mar 22 '11 at 22:44
  • that shouldn't be that hard to check. it would mean another query to the database, but if your database is local (same server as the site) it shouldn't really be noticeable. even if it's not, shouldn't be an issue. – Chaulky Mar 23 '11 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.