Skip to content
Snippets Groups Projects
Commit ed0f8b1f authored by Kristiaan Van den Eynde's avatar Kristiaan Van den Eynde
Browse files

Issue #3393273 by kristiaanvandeneynde: Pass scope and account data to alterPermissions in a BC way

parent d43c1184
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,10 @@ class ChainPermissionCalculator implements ChainPermissionCalculatorInterface {
// Alter mode, allow all calculators to alter the complete build.
$calculated_permissions->disableBuildMode();
foreach ($this->getCalculators() as $calculator) {
if ($calculator instanceof PermissionCalculatorAlterInterface) {
if ($calculator instanceof PermissionCalculatorAlterInterfaceV2) {
$calculator->alterPermissions($account, $scope, $calculated_permissions);
}
elseif ($calculator instanceof PermissionCalculatorAlterInterface) {
$calculator->alterPermissions($calculated_permissions);
}
}
......
<?php
namespace Drupal\flexible_permissions;
use Drupal\Core\Session\AccountInterface;
/**
* Defines an interface to alter the final calculated permissions.
*/
interface PermissionCalculatorAlterInterfaceV2 {
/**
* Alter the permissions after all calculators have finished building them.
*
* @param \Drupal\Core\Session\AccountInterface $account
* The user account for which to alter the permissions.
* @param string $scope
* The scope to alter the permissions for.
* @param \Drupal\flexible_permissions\RefinableCalculatedPermissionsInterface $calculated_permissions
* The completely built calculated permissions.
*/
public function alterPermissions(AccountInterface $account, $scope, RefinableCalculatedPermissionsInterface $calculated_permissions);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment