diff --git a/Template/config/integration.php b/Template/config/integration.php index bbf38ea..d21a90c 100644 --- a/Template/config/integration.php +++ b/Template/config/integration.php @@ -33,6 +33,10 @@ = $this->form->label(t('User ID Key'), 'oauth2_key_user_id') ?> = $this->form->text('oauth2_key_user_id', $values) ?> + = $this->form->hidden('oauth2_split_keys', array('oauth2_split_keys' => 0)) ?> + = $this->form->checkbox('oauth2_split_keys', t('Use composite keys?'), 1, isset($values['oauth2_split_keys']) && $values['oauth2_split_keys'] == 1) ?> +
= t('Interpret \'.\' in keys as keys for sub-objects') ?>
+ = $this->form->hidden('oauth2_account_creation', array('oauth2_account_creation' => 0)) ?> = $this->form->checkbox('oauth2_account_creation', t('Allow Account Creation'), 1, isset($values['oauth2_account_creation']) && $values['oauth2_account_creation'] == 1) ?> diff --git a/User/GenericOAuth2UserProvider.php b/User/GenericOAuth2UserProvider.php index e7c9909..3fc2a6d 100644 --- a/User/GenericOAuth2UserProvider.php +++ b/User/GenericOAuth2UserProvider.php @@ -274,11 +274,21 @@ public function validateDomainRestriction(array $profile, $domains) protected function getKey($key) { - $key = explode('.', $this->configModel->get($key)); - $value = $this->userData; - foreach ($key as $k) { - $value = $value[$k]; + if($this->configModel->get('oauth2_split_keys') == 1) { + $key = explode('.', $this->configModel->get($key)); + $value = $this->userData; + foreach ($key as $k) { + $value = $value[$k]; + } + return ! empty($key) && isset($value) ? $value : ''; + } else { + $key = $this->configModel->get($key); + if(empty($key)) { + return ''; + } + + $value = $this->userData[$key]; + return isset($value) ? $value : ''; } - return ! empty($key) && isset($value) ? $value : ''; } }