Fix attribute mapping config fetching

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-07-11 13:32:07 +02:00 committed by Bjoern Schiessle
parent 20757e9f0e
commit 00711b8fbb
No known key found for this signature in database
GPG key ID: 2378A753E2BF04F6
4 changed files with 11 additions and 4 deletions

View file

@ -73,7 +73,14 @@ class SettingsController extends Controller {
if (strpos($category, 'security-') === 0) { if (strpos($category, 'security-') === 0) {
$category = 'security'; $category = 'security';
} }
$key = $prefix . $category . '-' . $setting; // make sure we properly fetch the attribute mapping
// as this is the only category that has the saml- prefix on config keys
if (strpos($category, 'attribute-mapping') === 0) {
$category = 'attribute-mapping';
$key = $prefix . 'saml-attribute-mapping' . '-' . $setting;
} else {
$key = $prefix . $category . '-' . $setting;
}
$settings[$category][$setting] = $this->config->getAppValue('user_saml', $key, ''); $settings[$category][$setting] = $this->config->getAppValue('user_saml', $key, '');
} }
} }

View file

@ -148,7 +148,7 @@ class Admin implements ISettings {
'security-required' => $securityRequiredFields, 'security-required' => $securityRequiredFields,
'security-general' => $securityGeneral, 'security-general' => $securityGeneral,
'general' => $generalSettings, 'general' => $generalSettings,
'attributeMappings' => $attributeMappingSettings, 'attribute-mapping' => $attributeMappingSettings,
'type' => $type, 'type' => $type,
'providers' => $providers 'providers' => $providers
]; ];

View file

@ -120,7 +120,7 @@ style('user_saml', 'admin');
</p> </p>
<div class="hidden"> <div class="hidden">
<?php foreach($_['attributeMappings'] as $key => $attribute): ?> <?php foreach($_['attribute-mapping'] as $key => $attribute): ?>
<?php <?php
if($attribute['type'] === 'line'): ?> if($attribute['type'] === 'line'): ?>
<p> <p>

View file

@ -137,7 +137,7 @@ class AdminTest extends \Test\TestCase {
'security-required' => $securityRequiredFields, 'security-required' => $securityRequiredFields,
'security-general' => $securityGeneral, 'security-general' => $securityGeneral,
'general' => $generalSettings, 'general' => $generalSettings,
'attributeMappings' => $attributeMappingSettings, 'attribute-mapping' => $attributeMappingSettings,
'providers' => [ 'providers' => [
['id' => 1, 'name' => 'Provider 1'], ['id' => 1, 'name' => 'Provider 1'],
['id' => 2, 'name' => 'Provider 2'] ['id' => 2, 'name' => 'Provider 2']