Problem/Motivation

You can't alter the calculated items when using group_permissions.

Steps to reproduce

See the class GroupPermissionsChainPermissionCalculator, as defined in group_permissions.services.yml, it overrides the ChainPermissionCalculator::calculatePermissions function from the flexible_permission module.

But when you go in the flexible_permission module, in the class ChainPermissionCalculator class, you see that the calculatePermissions function allow you to override calculated items by using PermissionCalculatorAlterInterface or PermissionCalculatorAlterInterfaceV2 on line 153.

      // Alter mode, allow all calculators to alter the complete build.
      $calculated_permissions->disableBuildMode();
      foreach ($this->getCalculators() as $calculator) {
        if ($calculator instanceof PermissionCalculatorAlterInterfaceV2) {
          $calculator->alterPermissions($account, $scope, $calculated_permissions);
        }
        elseif ($calculator instanceof PermissionCalculatorAlterInterface) {
          $calculator->alterPermissions($calculated_permissions);
        }
      }

But group_permissions didn't implement this code and so remove this functionnality.

Proposed resolution

Set the code above on line 72 of GroupPermissionsChainPermissionCalculator.php in order to retrieve this functionnality.

CommentFileSizeAuthor
#2 group_permissions-3526210.patch1.67 KBolivierg

Comments

olivierg created an issue. See original summary.

olivierg’s picture

StatusFileSize
new1.67 KB

See the patch to solve this issue.

olivierg’s picture

Title: Alter calculator disabled bay Group permissions » Alter calculator disabled by Group permissions

  • lobsterr committed ca73fb68 on 2.0.x
    feat: #3526210 Alter calculator disabled by Group permissions
    
    By:...
lobsterr’s picture

Status: Active » Fixed

Thank you for your contribution

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.