Skip to content

Commit

Permalink
Fix issue #202: RoleManager::createLimitation fails when using array …
Browse files Browse the repository at this point in the history
…reference
  • Loading branch information
gggeek committed May 18, 2019
1 parent 7dcdcf8 commit 4019189
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Core/Executor/RoleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,19 @@ protected function createLimitation(RoleService $roleService, array $limitation)
{
$limitationType = $roleService->getLimitationType($limitation['identifier']);

$limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']);

foreach ($limitationValue as $id => $value) {
$limitationValue[$id] = $this->referenceResolver->resolveReference($value);
// 1st resolve refs (if we got passed a string)
$limitationValue = $this->referenceResolver->resolveReference($limitation['values']);
// then, if we have an array, resolve refs recursively
if (is_array($limitationValue)) {
foreach ($limitationValue as $id => $value) {
$limitationValue[$id] = $this->referenceResolver->resolveReference($value);
}
} else {
// if still a scalar, make sure we can loop over it
$limitationValue = array($limitationValue);
}


$limitationValue = $this->limitationConverter->resolveLimitationValue($limitation['identifier'], $limitationValue);
return $limitationType->buildValue($limitationValue);
}
Expand Down
6 changes: 6 additions & 0 deletions WHATSNEW.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 5.9.4
=============

* Fix issue #202: RoleManager::createLimitation fails when using array reference


Version 5.9.3
=============

Expand Down

0 comments on commit 4019189

Please sign in to comment.