This project is not covered by Drupal’s security advisory policy.
This module adds support for defining multiple permission sets per group type. Users that have permissions to create/edit groups can then choose which permission set will provide permissions for the group.
Features
By default, the permissions for each group role are provided at the group type level. Let's say, for example, you have a social media application where users can join groups. All groups would have the same exact permissions; if you wanted to have groups with different permissions you would need to create multiple group types.
This module allows creating multiple permission sets for each group type. You can then create a set that only allows group members to see group posts, another permission set that might allow some content types to be visible to non-members while others are visible only to members, and another permission set that makes all group content public.
Group administrators can then choose the permission set that should be used by each one of their groups.
Post-Installation
Edit the group types that you want to enable permission sets on, and select the provided checkbox.
This module does not yes provide a UI for creating/updating permission templates. Until that is implemented, a developer needs to define the permission sets as configuration in the code. Here is an example.
The naming convention is to use the ID of the group type as a prefix, then something that is meaningful for your use case. But this is just a suggestion, use the naming conventions that work for your use case. Always create a default set for each group type, whether you name it as such or not.
# group_permission_set.set.my_group_type_default.yml
langcode: en
status: true
dependencies: { }
id: my_group_type_default
label: Default
description: 'The default permission set for groups of type My Group Type. Allows access to view published page/post content items to all anonymous and authenticated users, but only allows access to view published exclusive content items to users with the Member role in the group.'
group_type_id: my_group_type
permissions:
my_group_type-admin: { }
my_group_type-anonymous:
- 'view node:page entity'
- 'view node:post entity'
my_group_type-authenticated:
- 'view node:page entity'
- 'view node:post entity'
my_group_type-member:
- 'view node:page entity'
- 'view node:post entity'
- 'view node:exclusive entity'
You can then import the configuration using drush cim and you'll get the permission set created in the system and available to all groups of type my_group_type.
Additional Requirements
Currently, this module works only with Group version 3.
Similar projects
See #3425908: How is this module different to Group Permissions and Group Permissions Template.
Project information
- Project categories: Access control
- Ecosystem: Group
- Created by krystalcode on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Development version: 1.x-dev updated 7 Oct 2024 at 14:02 UTC
