diff --git a/src/Authorization/AuthorizationDataMuxer.php b/src/Authorization/AuthorizationDataMuxer.php index 49705938ccd5275313f954aacb71482524243b9d..424d35dcca555d147dbdb560216ca83bf852c93b 100644 --- a/src/Authorization/AuthorizationDataMuxer.php +++ b/src/Authorization/AuthorizationDataMuxer.php @@ -10,7 +10,7 @@ class AuthorizationDataMuxer private $authorizationDataProviders; /** @var array */ - private $customAttributes; + private $attributes; /** * @param iterable<AuthorizationDataProviderInterface> $authorizationDataProviders @@ -18,7 +18,7 @@ class AuthorizationDataMuxer public function __construct(iterable $authorizationDataProviders) { $this->authorizationDataProviders = $authorizationDataProviders; - $this->customAttributes = []; + $this->attributes = []; } private function loadUserAttributesFromAuthorizationProvider(?string $userIdentifier, AuthorizationDataProviderInterface $authorizationDataProvider): void @@ -27,7 +27,7 @@ class AuthorizationDataMuxer foreach ($authorizationDataProvider->getAvailableAttributes() as $availableAttribute) { if (array_key_exists($availableAttribute, $userAttributes)) { - $this->customAttributes[$availableAttribute] = $userAttributes[$availableAttribute]; + $this->attributes[$availableAttribute] = $userAttributes[$availableAttribute]; } } } @@ -55,19 +55,19 @@ class AuthorizationDataMuxer * * @throws AuthorizationException */ - public function getCustomAttribute(?string $userIdentifier, string $attributeName, $defaultValue = null) + public function getAttribute(?string $userIdentifier, string $attributeName, $defaultValue = null) { - if (array_key_exists($attributeName, $this->customAttributes) === false) { - $this->loadCustomAttribute($userIdentifier, $attributeName); + if (array_key_exists($attributeName, $this->attributes) === false) { + $this->loadAttribute($userIdentifier, $attributeName); } - return $this->customAttributes[$attributeName] ?? $defaultValue; + return $this->attributes[$attributeName] ?? $defaultValue; } /** * @throws AuthorizationException */ - private function loadCustomAttribute(?string $userIdentifier, string $attributeName): void + private function loadAttribute(?string $userIdentifier, string $attributeName): void { $wasFound = false; foreach ($this->authorizationDataProviders as $authorizationDataProvider) { diff --git a/src/Authorization/AuthorizationExpressionChecker.php b/src/Authorization/AuthorizationExpressionChecker.php index 1eb373488eea7484eb4b01a90400344e81581169..2363d9ef40e4ec061401222ff6b00c89f70ed256 100644 --- a/src/Authorization/AuthorizationExpressionChecker.php +++ b/src/Authorization/AuthorizationExpressionChecker.php @@ -77,7 +77,7 @@ class AuthorizationExpressionChecker */ public function getCustomAttribute(AuthorizationUser $currentAuthorizationUser, string $attributeName, $defaultValue = null) { - return $this->dataMux->getCustomAttribute($currentAuthorizationUser->getIdentifier(), $attributeName, $defaultValue); + return $this->dataMux->getAttribute($currentAuthorizationUser->getIdentifier(), $attributeName, $defaultValue); } /** diff --git a/src/Authorization/DebugCommand.php b/src/Authorization/DebugCommand.php index 13c0794efdf062ffa820e025ed8ffba6008d602e..619d0ac2c39e1b1c56d3566d45925e4c796b90bc 100644 --- a/src/Authorization/DebugCommand.php +++ b/src/Authorization/DebugCommand.php @@ -46,7 +46,7 @@ class DebugCommand extends Command implements LoggerAwareInterface $default = new \stdClass(); sort($attrs, SORT_STRING | SORT_FLAG_CASE); foreach ($attrs as $attr) { - $all[$attr] = $mux->getCustomAttribute($username, $attr, $default); + $all[$attr] = $mux->getAttribute($username, $attr, $default); } // Now print them out