protected function UserFieldsEventSubscriber::getUpdatableAttributeValue in SAML Authentication 8.3
Same name and namespace in other branches
- 4.x modules/samlauth_user_fields/src/EventSubscriber/UserFieldsEventSubscriber.php \Drupal\samlauth_user_fields\EventSubscriber\UserFieldsEventSubscriber::getUpdatableAttributeValue()
Returns 'updatable' value from a SAML attribute; logs anything strange.
'Updatable' here does not necessarily mean the value will actually be updated because we are not comparing it with the current destination field value here. It just means the value in itself could be written into the field. This standard implementation treats empty strings as "no value" rather than "an empty value".
Parameters
string $name: The name of a SAML attribute.
array $attributes: The complete set of SAML attributes in the assertion. (The attributes can currently be duplicated, keyed both by their name and friendly name.)
Return value
mixed|null The SAML attribute value; NULL if the attribute value was not found or should not be used for updating.
1 call to UserFieldsEventSubscriber::getUpdatableAttributeValue()
- UserFieldsEventSubscriber::onUserSync in modules/
samlauth_user_fields/ src/ EventSubscriber/ UserFieldsEventSubscriber.php - Saves configured SAML attribute values into user fields.
File
- modules/
samlauth_user_fields/ src/ EventSubscriber/ UserFieldsEventSubscriber.php, line 398
Class
- UserFieldsEventSubscriber
- Synchronizes SAML attributes into user fields / links new users during login.
Namespace
Drupal\samlauth_user_fields\EventSubscriberCode
protected function getUpdatableAttributeValue($name, array $attributes) {
$value = $this
->getAttribute($name, $attributes);
// In absence of exact detailed knowledge/trust of our input
// value, we'll fall back to generic rules that usually work:
// - Do not treat "" as a value - i.e. don't overwrite a field with "".
// - Do treat some other similar values (like 0) as a value. See
// isInputValueEqual() for more details.
return isset($value) && !$this
->isInputValueEqual($value, '') ? $value : NULL;
}