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.

3 Answers 3


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.


there is a module exactly for that ATB module, only for D7, from module page:

Provides very flexible, hierarchical node access control (content access control), for D7. Supports following flags: View Update Delete Grants are based on the relationship between the user->term<-node. Taxonomy terms act as common denominators and allow many-to-many relationships between users and nodes. Organize your taxonomy terms hierarchically, this approach will allow for access grant inheritance. Nodes found in Views are also filtered out when user lacks permissions. Very simple, easy to understand logic and very little code. Uses lots of native functionality. Use any number of fields/vocabularies to control access for any number of content types. Has it's own automated tests. Detailed help section.

I have used this module for "group type" sites, combined with sub-user module, users and nodes that has exaclty the same taxonomy term can view/update/delete content at your will, this is done in node field settings; but it has a down side, there is a core locale module conflict, meaning that you can't traslate the site.


Instead of using the Taxonomy Access Control module (a D7 module with no D8 plans ...), you might want to give it a try to use the Group module, which allows for creating arbitrary collections of your content and users on your site, and grant access control permissions on those collections.

It is available as of D7, and has a D8 version also. It creates groups as entities, making them fully fieldable, extensible and exportable. Every group can have users, roles and permissions attached to it (refer to "What are the various roles supported by the Group module?" for more details about that).

For this specific question, you'd enable the gnode submodule, and for each group type you would define the appropriate permissions (view, edit, delete, etc) for the various Content Types. You'd probably want to create a Group type "Enterprise", and then create groups that you'd label similar to the taxonomy terms (AAA, PPP, ...) that you have defined.

For the Group permissions it seems that you would want to grant edit access to what, in Group, is called "Members". And combine that with view access (= see all) for:

  • "Outsiders" (= logged in users who are not a member of a group).
  • "Anonymous" (site visitors that are not logged it).

As per the "I created a taxonomy for enterprise and I referenced it in a field of user profile" in your question, you could use that user profile field to make a specific user a member of a specific group.

That's really "it", and it doesn't matter if your question is about D7, or D8 (either one will work).

For a sample configuration of the Group module, refer to my answer to "How to configure access for creating a custom LMS?".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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