You are here

protected function UserFieldsEventSubscriber::isInputValueUpdatable in SAML Authentication 8.3

Same name and namespace in other branches
  1. 4.x modules/samlauth_user_fields/src/EventSubscriber/UserFieldsEventSubscriber.php \Drupal\samlauth_user_fields\EventSubscriber\UserFieldsEventSubscriber::isInputValueUpdatable()

Checks if a value should be updated into an existing user account field.

Unused / deprecated in favor of getUpdatableAttributeValue(). Will likely be removed in the next major version.

Parameters

mixed $input_value: The value to (maybe) update / write into the user account field.

\Drupal\user\UserInterface $account: The Drupal user account.

string $account_field_name: The field name in the user account.

Return value

bool True if the account should be updated (that is: if it's different and not considered 'empty'). This does not imply the value is valid; validity should still be checked.

File

modules/samlauth_user_fields/src/EventSubscriber/UserFieldsEventSubscriber.php, line 373

Class

UserFieldsEventSubscriber
Synchronizes SAML attributes into user fields / links new users during login.

Namespace

Drupal\samlauth_user_fields\EventSubscriber

Code

protected function isInputValueUpdatable($input_value, UserInterface $account, $account_field_name) {
  return $account
    ->hasField($account_field_name) && !$this
    ->isInputValueEqual($input_value, '') && !$this
    ->isInputValueEqual($input_value, $account
    ->get($account_field_name)->value, $account_field_name);
}