You are here

public function BakeryService::updateUserFields in Bakery Single Sign-On System 8.2

Update a user account with fields from a cookie.

Parameters

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

array $cookie: Cookie data. From either stroopwafel or gingerbread.

1 call to BakeryService::updateUserFields()
BakeryService::requestAccount in src/BakeryService.php
Request account information from master to create account locally.

File

src/BakeryService.php, line 190
Services used in bakery SSO functions.

Class

BakeryService
Common functionalities used in both controller and module.

Namespace

Drupal\bakery

Code

public function updateUserFields(UserInterface $account, array $cookie) {
  foreach ($this->config
    ->get('bakery_supported_fields') as $type => $enabled) {
    if ($enabled && isset($cookie[$type])) {
      switch ($type) {
        case 'name':
          $account
            ->setUsername($cookie['name']);
          break;
        case 'mail':
          $account
            ->setEmail($cookie['mail']);
          break;
        default:
      }
    }
  }
}