Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

This module allows you to dynamically set group permissions based on custom parameters within a group. It integrates with the Group Permissions module, enabling permissions to be adjusted automatically when a group is saved. The module also provides a tool to synchronize these permissions with group type settings for existing groups.

This module provides API to set group permissions on the group level using Group permissions module based on custom parameters (e.g. field in the group). Setting the permissions of a group is executed when saving it.

Features:

  • Provides plugin base to set your mutable permissions (the permissions that depend on your parameters) while using the the permissions UI that comes with the group module to set the common permissions (the permissions that don't depend on parameters - fixed permissions).
  • Provides a service for setting your mutable permissions using other way than creating GroupPermissionsParameter plugin instances. You identify the way yourself.
  • To use GroupPermissionsParameter plugin for setting your mutable permissions, you could create a plugin instance per parameter or one plugin instance for multiple parameters
  • Provides a form to sync the permissions on the group level with permissions from the group type level. This is useful in case new permissions should be granted to/revoked from existing groups. In your plugin, you can identify whether the mutable permissions should be applied on syncing or not. The form can be found under Groups menu.

Example:

<?php

declare(strict_types = 1);

namespace Drupal\custom_module\Plugin\GroupPermissionsParameter;

use Drupal\group\Entity\GroupInterface;
use Drupal\group_permissions_parameter\GroupPermissionsParameterBase;

/**
 * Plugin for group privacy group permissions parameter.
 *
 * @GroupPermissionsParameter(
 *   id = "my_group_privacy",
 *   label = @Translation("My group privacy"),
 *   description = @Translation("Custom permissions for my group based on the group privacy"),
 *   bundles = {
 *     "my_group",
 *   },
 *   weight = 0,
 * )
 */
class myGroupPrivacy extends GroupPermissionsParameterBase {

  /**
   * {@inheritdoc}
   */
  public function getPermissions(GroupInterface $group): array {
    $permissions = [];

    // Setup permissions for anonymous.
    $permissions['my_group-anonymous'] = [
      'view group_node:page entity' => $group->isPublic(),
    ];

    // Setup permissions for outsider.
    $permissions['my_group-outsider'] = [
      'join group' => $group->isPublic(),
      'view group_node:page entity' => $group->isPublic(),
    ];

    return $permissions;
  }

  /**
   * {@inheritdoc}
   */
  public function isAppliedOnCreate(GroupInterface $group): bool {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function isAppliedOnUpdate(GroupInterface $group): bool {
    if (!empty($group) && !empty($group->original)) {
      if ($group->getPrivacy() !== $group->original->getPrivacy()) {
        return TRUE;
      }
    }

    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function isAppliedOnSync(GroupInterface $group): bool {
    return TRUE;
  }

}

Activity

Tracked releases
1
Tracked since
May 2026
Latest release
3 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
2.1.0-alpha1 Pre-release May 18, 2026