Help Request - Node Access Project
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3564534. --> Reported by: [wattdesigns](https://www.drupal.org/user/243293) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I used an old Drupal 7 module called Access by Term (<a href="https://www.drupal.org/project/abt">https://www.drupal.org/project/abt</a>). It is no longer supported and not ported to Drupal 8 or higher. This module allowed me to have a term set on the node and if the user had the same term set on their user profile, they could see the node. Otherwise, they would not. Very simple and useful for me. The new Drupal 10 site I currently have needs this same type of access that I cannot find without serious modifications to the database. I thought ECA might be a help here!</p> <p>Here's what I need (with some notes in [ ]):</p> <ul> <li>Action - open a node of type Training [that's the node type I have that I want to limit access]</li> <li>Check to see if user is Admin or Training Coordinator roles - if so, open the node and end the check. [I don't want Admin or Training Coordinator roles ever to be blocked from a node, so they should just look at it normally]</li> <li>If NOT Admin or Training Coordinator roles - check to see if the node Term is empty. If empty, open the node and end. [If the node doesn't have a term assigned, anyone can view the node]</li> <li>If the term is NOT empty, see if the term matches the term on the current user profile. If match, open the node and end. [Only users that match the term can see the node]</li> <li>If the Term is NOT empty, and DOESNT match user profile. Show a message that the user doesn't have permission to see the training node. [This could be a redirect to a node, or a custom message. They just can't see the node]</li> <li>End the ECA check</li> </ul> <p>For additional information, the node term is an Entity reference/Reference type: Taxonomy term/Vocabulary: Agency field and the user profile has the same Agency vocabulary term that they can select when editing their profile. Basically, there are multiple different Agencies that use the site and we have some nodes that we only want people who belong to a certain agency to have access to. Also note, I realize that people could just change their user profile to the proper agency to bypass this, but that's OK. It's not that high of a security issue. It's mainly just to let people know that they shouldn't access this content.</p> <p>I'm fairly new to ECA. Would someone be able to help me with this?</p> <p>Thanks!</p> <p>Michael</p>
issue