summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-08-15 15:55:06 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-08-15 15:55:06 +0200
commit479f893f6ddef6a102b8f4ff3f68fc0b64838710 (patch)
treee43275170f0293f100dff28261011465fc9fe6a9 /apps
parentcbfee81068d47d246deac9902f12bf63258a03e0 (diff)
downloadnextcloud-server-479f893f6ddef6a102b8f4ff3f68fc0b64838710.tar.gz
nextcloud-server-479f893f6ddef6a102b8f4ff3f68fc0b64838710.zip
LDAP: Show Host name in configuration drop down
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/helper.php28
-rw-r--r--apps/user_ldap/settings.php2
-rw-r--r--apps/user_ldap/templates/settings.php2
3 files changed, 31 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index f65f466789f..4c9dd07a12c 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -71,6 +71,34 @@ class Helper {
}
/**
+ *
+ * @brief determines the host for every configured connection
+ * @return an array with configprefix as keys
+ *
+ */
+ static public function getServerConfigurationHosts() {
+ $referenceConfigkey = 'ldap_host';
+
+ $query = '
+ SELECT DISTINCT `configkey`, `configvalue`
+ FROM `*PREFIX*appconfig`
+ WHERE `appid` = \'user_ldap\'
+ AND `configkey` LIKE ?
+ ';
+ $query = \OCP\DB::prepare($query);
+ $configHosts = $query->execute(array('%'.$referenceConfigkey))->fetchAll();
+ $result = array();
+
+ foreach($configHosts as $configHost) {
+ $len = strlen($configHost['configkey']) - strlen($referenceConfigkey);
+ $prefix = substr($configHost['configkey'], 0, $len);
+ $result[$prefix] = $configHost['configvalue'];
+ }
+
+ return $result;
+ }
+
+ /**
* @brief deletes a given saved LDAP/AD server configuration.
* @param string the configuration prefix of the config to delete
* @return bool true on success, false otherwise
diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php
index 22e2dac6d26..7169192a18e 100644
--- a/apps/user_ldap/settings.php
+++ b/apps/user_ldap/settings.php
@@ -44,7 +44,9 @@ OCP\Util::addstyle('user_ldap', 'settings');
$tmpl = new OCP\Template('user_ldap', 'settings');
$prefixes = \OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes();
+$hosts = \OCA\user_ldap\lib\Helper::getServerConfigurationHosts();
$tmpl->assign('serverConfigurationPrefixes', $prefixes);
+$tmpl->assign('serverConfigurationHosts', $hosts);
// assign default values
if(!isset($ldap)) {
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index c051ea5cfe1..e214d57fb1d 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -24,7 +24,7 @@
$sel = ' selected';
foreach($_['serverConfigurationPrefixes'] as $prefix) {
?>
- <option value="<?php p($prefix); ?>"<?php p($sel); ?>><?php p($i++); ?>. Server</option>
+ <option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($i++); ?>. Server: <?php p($_['serverConfigurationHosts'][$prefix]); ?></option>
<?php
}
}