[LDAP] The WebUI Wizard also should not assign empty config IDs
With 689df9a843
the behaviour to assign only
non-empty config IDs was introduced. Only, this was only effective for CLI
and OCS API.
Related to #3270.
The web UI creates now also a full configuration on first load. This fixes
#5094.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
c0f48a7b40
commit
7807add02d
|
@ -49,6 +49,14 @@ class Admin implements ISettings {
|
||||||
public function getForm() {
|
public function getForm() {
|
||||||
$helper = new Helper(\OC::$server->getConfig());
|
$helper = new Helper(\OC::$server->getConfig());
|
||||||
$prefixes = $helper->getServerConfigurationPrefixes();
|
$prefixes = $helper->getServerConfigurationPrefixes();
|
||||||
|
if(count($prefixes) === 0) {
|
||||||
|
$newPrefix = $helper->getNextServerConfigurationPrefix();
|
||||||
|
$config = new Configuration($newPrefix, false);
|
||||||
|
$config->setConfiguration($config->getDefaults());
|
||||||
|
$config->saveConfiguration();
|
||||||
|
$prefixes[] = $newPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
$hosts = $helper->getServerConfigurationHosts();
|
$hosts = $helper->getServerConfigurationHosts();
|
||||||
|
|
||||||
$wControls = new Template('user_ldap', 'part.wizardcontrols');
|
$wControls = new Template('user_ldap', 'part.wizardcontrols');
|
||||||
|
@ -62,7 +70,9 @@ class Admin implements ISettings {
|
||||||
$parameters['wizardControls'] = $wControls;
|
$parameters['wizardControls'] = $wControls;
|
||||||
|
|
||||||
// assign default values
|
// assign default values
|
||||||
|
if(!isset($config)) {
|
||||||
$config = new Configuration('', false);
|
$config = new Configuration('', false);
|
||||||
|
}
|
||||||
$defaults = $config->getDefaults();
|
$defaults = $config->getDefaults();
|
||||||
foreach($defaults as $key => $default) {
|
foreach($defaults as $key => $default) {
|
||||||
$parameters[$key.'_default'] = $default;
|
$parameters[$key.'_default'] = $default;
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<fieldset id="ldapWizard1">
|
<fieldset id="ldapWizard1">
|
||||||
<p>
|
<p>
|
||||||
<select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
|
<select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
|
||||||
<?php if(count($_['serverConfigurationPrefixes']) === 0 ) {
|
|
||||||
?>
|
|
||||||
<option value="" selected><?php p($l->t('1. Server'));?></option>');
|
|
||||||
<?php
|
<?php
|
||||||
} else {
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$sel = ' selected';
|
$sel = ' selected';
|
||||||
foreach($_['serverConfigurationPrefixes'] as $prefix) {
|
foreach($_['serverConfigurationPrefixes'] as $prefix) {
|
||||||
|
@ -13,7 +9,6 @@
|
||||||
<option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($l->t('%s. Server:', array($i++)));?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option>
|
<option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($l->t('%s. Server:', array($i++)));?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<button type="button" id="ldap_action_add_configuration"
|
<button type="button" id="ldap_action_add_configuration"
|
||||||
|
|
|
@ -56,10 +56,8 @@ class AdminTest extends TestCase {
|
||||||
* @UseDB
|
* @UseDB
|
||||||
*/
|
*/
|
||||||
public function testGetForm() {
|
public function testGetForm() {
|
||||||
|
$prefixes = ['s01'];
|
||||||
$helper = new Helper(\OC::$server->getConfig());
|
$hosts = ['s01' => ''];
|
||||||
$prefixes = $helper->getServerConfigurationPrefixes();
|
|
||||||
$hosts = $helper->getServerConfigurationHosts();
|
|
||||||
|
|
||||||
$wControls = new Template('user_ldap', 'part.wizardcontrols');
|
$wControls = new Template('user_ldap', 'part.wizardcontrols');
|
||||||
$wControls = $wControls->fetchPage();
|
$wControls = $wControls->fetchPage();
|
||||||
|
|
Loading…
Reference in New Issue