Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flexible_permissions
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
flexible_permissions
Commits
ed0f8b1f
Commit
ed0f8b1f
authored
1 year ago
by
Kristiaan Van den Eynde
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3393273
by kristiaanvandeneynde: Pass scope and account data to alterPermissions in a BC way
parent
d43c1184
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ChainPermissionCalculator.php
+4
-1
4 additions, 1 deletion
src/ChainPermissionCalculator.php
src/PermissionCalculatorAlterInterfaceV2.php
+24
-0
24 additions, 0 deletions
src/PermissionCalculatorAlterInterfaceV2.php
with
28 additions
and
1 deletion
src/ChainPermissionCalculator.php
+
4
−
1
View file @
ed0f8b1f
...
...
@@ -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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/PermissionCalculatorAlterInterfaceV2.php
0 → 100644
+
24
−
0
View file @
ed0f8b1f
<?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
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment