Hello !

Even with the "creating a condition" tutorial (http://drupal.org/node/1215344) and some issues of this module and of Rules module, I cannot see what should be a condition and what has to be an event, so I expose you my particular case and hope someone will light up my way :-D :

I am try to create a rule which will grant rights to users referenced by a term on nodes referencing this same term. I already have a view listing all users referenced by a given term and another view listing all nodes referencing a given term, but since these can only be used as actions, I guess I will have to user another rule which triggers the first one (which uses these views) ?

It would be wonderful if someone could help be a little bit.
Thanks in advance anyway.

Comments

itangalo’s picture

Status: Active » Fixed

The approach would be the following, I guess:

* Create a rule set that takes a term as parameter.
* Load the list of users that has this term.
* Load the list of nodes that has the term.
* Loop through the node list, and inside the loop add another loop that iterates through the user list.
* Inside the second loop, place an action that grants the relevant user access to the relevant node. (This can be done by combining Content Access and ACL, and probably in a dozen other ways.)

Finally, you'll need to call this rule set from relevant events:
* Add a reaction rule, reacting on new content has been saved. Call the rule set for each (relevant) term on the node.
* Add a reaction rule, reacting on updates of existing content. If the list of (relevant) terms has changed, call the reaction rule for each term.
* Add a reaction rule, reacting on new account created. Call the rule set for each (relevant) term on the account.
* Similarly, also call the rule set on user account updates, if the list of (relevant) terms has changed.

Note that this operation will be heavy. Depending on your site, it will save tens, hundreds or thousands of nodes. It has potential to exhaust your PHP memory.

On way of making it lighter is to break it up into two distinct ones – one that (A) grants access for a specified user to all nodes with the specified term, and one that (B) grants access for all users with the specified term to one specified node. The B set could be used from the first two reaction rules above, and A for the last two ones.

I think this use case is covered by Taxonomy Access Control Lite (tac_lite). If so, I would recommend using that module instead of building this with Rules (and risking PHP memory errors). However, I'm not sure that this is covered, and I don't know the module's status for Drupal 7.

Good luck!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kaizerking’s picture

Status: Closed (fixed) » Active

@FrequenceBanane , I have the same requirement, are you able to achieve this, if so please share how you did it ?
Taxonomy Access Control Lite (tac_lite) doesnt have D 7 version even for checking