diff options
Diffstat (limited to 'apps/user_ldap/ajax/getNewServerConfigPrefix.php')
-rw-r--r-- | apps/user_ldap/ajax/getNewServerConfigPrefix.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 7d1434a8fb4..d0135917886 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -32,4 +32,17 @@ sort($serverConnections); $lk = array_pop($serverConnections); $ln = intval(str_replace('s', '', $lk)); $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); -OCP\JSON::success(array('configPrefix' => $nk)); + +$resultData = array('configPrefix' => $nk); + +if(isset($_POST['copyConfig'])) { + $originalConfig = new \OCA\user_ldap\lib\Configuration($_POST['copyConfig']); + $newConfig = new \OCA\user_ldap\lib\Configuration($nk, false); + $newConfig->setConfiguration($originalConfig->getConfiguration()); + $newConfig->saveConfiguration(); +} else { + $configuration = new \OCA\user_ldap\lib\Configuration($nk, false); + $resultData['defaults'] = $configuration->getDefaults(); +} + +OCP\JSON::success($resultData); |