Using the Group module to administrator content editor access control in Drupal 8

A new major version of Drupal core not only means contributed module developers are hard at work upgrading their modules to the new version, but it also gives us the opportunity to think about existing solutions and re-imagining them using all the new advancements Drupal 8. The Group module isn't a new module for Drupal 8, but with the Organic Groups upgrade not having any traction at the moment, it is getting some (worthy) attention. The lead maintainer of the Group module, Kristiaan Van Den Eynde (kristiaanvandeneynde), has re-written the module for Drupal 8 in order to take advantage of all the improvements Drupal 8 has to offer. His company, Deeson sponsors development of the module (thank you!)

This screencast demonstrates how to use the Group module to configure a site so that different sets of people have permission to administer content only in specific areas (groups). Consider the case where a large library with multiple physical locations has a site where staff from each branch can only administer (add/edit/delete) content in their section of the site.

Library branch locations diagram

In order to fully comprehend the Group module, it is important to note the following:

  • "Group type" is a fieldable entity (user-defined groups are not nodes).
  • "Group membership" (for users) is a per-"Group type" fieldable entity (implemented via a Plugin). Therefore, each "Group type" can have different fields describing the user memberships.
  • The "Group node" module (part of the main "Group" project) provides per-"Group type" fieldable entities for each content type on the site (also implemented via a Plugin). Therefore, each "Group type" can have different fields describing the relationship between nodes of a given content type and a group.

Group module entity diagram

With both "Group membership" and "Group node" entities being fieldable and providing the relationship between a group and a user and node (respectively), they are similar in concept to the Drupal 7 Relation module.

The future of the Group module

While there is still a bit of work to do for the 1.0 release, once that is available, Kris indicates that writing migration support from Drupal 7 Group and Organic Groups to the Drupal 8 Group module will be a focus.

Resources

Thanks for this great use case and deep explanation of the Group module for D8. I still have to wrap my head around my particular needs, but this was extremely helpful.

Submitted by Steve Fisher (not verified) on Fri, 04/22/2016 - 14:24