I can't create subgroups in the 8.x-1.0 branch of the Group module.

Is this feature on the roadmap?

CommentFileSizeAuthor
#9 ggroup.zip1.83 KBmatslats

Comments

Anonymous’s picture

spoetnik created an issue. See original summary.

kristiaanvandeneynde’s picture

It indirectly is on the roadmap you can find here #2693167: [meta] D8 release roadmap, more specifically, check #2693209: API: Allow modules to change the roles you have during permission checks.

Once we land that one, we have everything we need to be able to create a subgroup module. Currently the focus lies on that roadmap, though.

pwolanin’s picture

Looks like it's possible to work on this now - is there any more detail on preferred implementation?

kristiaanvandeneynde’s picture

Uhm yeah :)

  • Start off with a GroupContentEnabler plugin that does nothing more than allow you to add groups to other groups.
  • Use a deriver, just like the group_node plugin does to create a plugin derivative per group type.
  • In your plugin's configuration form, read the roles from the group type you're on AND from the group type you're targeting.
  • Then build a UI that says "People with role X will receive role Y in child groups", perhaps a list of checkboxes per role or a matrix. (table of checkboxes)
  • When a person's permissions are checked, see if the group has a parent group and try to read the roles from there. Perhaps this should be recursive so that you can inherit from grandparents and other ancestors too.

That would be a good start!

pwolanin’s picture

So, it seems like one of hard (and most important) parts of this is the recursive inheritance of roles. From what I understand there are also very few roles that exist across all groups? Should this add the ability to define additional roles that exist in all groups and only inherit those?

kristiaanvandeneynde’s picture

It shouldn't. Every group type has its own unique set of roles. Some may seem the same (such as anon/outsider/member), but they are in fact unique under the hood.

So in order to sync roles, you need to map them and then use hook_group_user_roles_alter() to apply said map.

pwolanin’s picture

@kristiaanvandeneynde that doesn't sound very user friendly to have to code such a mapping?

It seems like the mapping should at least happen at the level of the relationship between the two groups?

kristiaanvandeneynde’s picture

Yes it should, but someone needs to code it :)

The idea is that the plugin has the code to figure out what the user configured in the UI, then applies that logic in hook_group_user_roles_alter()

matslats’s picture

StatusFileSize
new1.83 KB

The attached is a ggroup module which contains a basic GroupContentEnabler plugin.

kristiaanvandeneynde’s picture

Status: Active » Closed (duplicate)

Closing in favor of #2736233: Port Subgroup (ggroup) to the D8 version, adding credit for matslats.