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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | group_permissions-3526210.patch | 1.67 KB | olivierg |
Comments
Comment #2
olivierg commentedSee the patch to solve this issue.
Comment #3
olivierg commentedComment #5
lobsterr commentedThank you for your contribution