Skip to content
Snippets Groups Projects
Commit 51966acf authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Rename customAttributes to just attributes

These are all the attributes we have now.
parent 7ed81087
Branches
Tags
No related merge requests found
......@@ -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) {
......
......@@ -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);
}
/**
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment