Skip to content
Commits on Source (6)
......@@ -12,10 +12,16 @@
},
"packageRules": [
{
"matchPackagePrefixes": [
"symfony/"
],
"matchPackagePrefixes": ["symfony/"],
"allowedVersions": "<6"
},
{
"matchPackageNames": ["api-platform/core"],
"allowedVersions": "<2.7"
},
{
"matchPackageNames": ["friendsofphp/php-cs-fixer"],
"allowedVersions": "<=3.4.0"
}
],
"js": {
......
This diff is collapsed.
......@@ -10,12 +10,6 @@ use Symfony\Component\HttpFoundation\Response;
abstract class AbstractAuthorizationService
{
public const AUTHORIZATION_CONFIG_ATTRIBUTE = 'authorization';
public const RIGHTS_CONFIG_ATTRIBUTE = 'rights';
public const ATTRIBUTES_CONFIG_ATTRIBUTE = 'attributes';
public const NAME_CONFIG_ATTRIBUTE = 'name';
public const EXPRESSION_CONFIG_ATTRIBUTE = 'expression';
/** @var UserAuthorizationChecker */
private $userAuthorizationChecker;
......@@ -30,7 +24,7 @@ abstract class AbstractAuthorizationService
public function setConfig(array $config)
{
$this->userAuthorizationChecker->setConfig($config[self::AUTHORIZATION_CONFIG_ATTRIBUTE]);
$this->userAuthorizationChecker->setConfig($config);
}
/**
......
......@@ -10,6 +10,9 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
class UserAuthorizationChecker
{
public const RIGHTS_CONFIG_ATTRIBUTE = 'rights';
public const ATTRIBUTES_CONFIG_ATTRIBUTE = 'attributes';
private const MAX_NUM_CALLS = 16;
/** @var string */
......@@ -47,8 +50,8 @@ class UserAuthorizationChecker
public function setConfig(array $config)
{
$this->loadExpressions($config[AbstractAuthorizationService::RIGHTS_CONFIG_ATTRIBUTE], $this->rightExpressions);
$this->loadExpressions($config[AbstractAuthorizationService::ATTRIBUTES_CONFIG_ATTRIBUTE], $this->attributeExpressions);
$this->loadExpressions($config[self::RIGHTS_CONFIG_ATTRIBUTE], $this->rightExpressions);
$this->loadExpressions($config[self::ATTRIBUTES_CONFIG_ATTRIBUTE], $this->attributeExpressions);
}
public function init()
......@@ -120,8 +123,8 @@ class UserAuthorizationChecker
private function loadExpressions(array $expressions, array &$target): void
{
foreach ($expressions as $expression) {
$target[$expression[AbstractAuthorizationService::NAME_CONFIG_ATTRIBUTE]] = $expression[AbstractAuthorizationService::EXPRESSION_CONFIG_ATTRIBUTE];
foreach ($expressions as $name => $expression) {
$target[$name] = $expression;
}
}
......