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) {
$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, '');
}
}

View File

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

View File

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

View File

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