Allow role to edit node with same taxonomy term I would like to allow a user to edit some node that have the same taxonomy term.

I created a taxonomy for enterprise and I referenced it in a field of user profile. I used this taxonomy in a content type too.

I wonder if it's possible to allow users to edit only nodes with the same taxonomy term, as in this example:


Users :


Alex - enterprise : AAA
Paul - enterprise : PPP

Nodes :


1 - enterprise : AAA
2 - enterprise : AAA
3 - enterprise : PPP



In this example:


Alex can edit node 1 and 2 only, and see all.
Paul can edit node 3 only, see all.


I tested taxonomy access control but I have to create a role for each enterprise to edit node with same term enterprise. But I have more than 100 enterprises.
A few year's back, I had to do this for a D7 site with 100s of content providers that could only post in specific areas.  Did this by have a protected section taxonomy field on the user profile.

Then used hook_node_access to test if the node had a term that matched on of them on the user profile.

That's the basics.

I think I had to do a custom validator for the node create form to check that they were creating nodes with approved terms.

I also think the node create form and edit forms had the term lists cut down to just allowed terms by using a view as the source of the selection list.

Sorry for being general, I haven't worked on that site for years and don't have the code anymore.