aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/helper.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-01-24 22:39:05 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-01-24 22:39:05 +0100
commit2749a14171ee7ce32085cc2d0edbfcd5490d2ca3 (patch)
tree3ee167082c5ba0a34148bc866b942331de7f69bb /apps/user_ldap/lib/helper.php
parent6bc72569666ac5fc8063a4b6233fb25a8ec94060 (diff)
downloadnextcloud-server-2749a14171ee7ce32085cc2d0edbfcd5490d2ca3.tar.gz
nextcloud-server-2749a14171ee7ce32085cc2d0edbfcd5490d2ca3.zip
LDAP: make it possible to enable/disable server configurations
Diffstat (limited to 'apps/user_ldap/lib/helper.php')
-rw-r--r--apps/user_ldap/lib/helper.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index 5f6e2a1d037..03a65a65b1c 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -27,6 +27,8 @@ class Helper {
/**
* @brief returns prefixes for each saved LDAP/AD server configuration.
+ * @param bool optional, whether only active configuration shall be
+ * retrieved, defaults to false
* @return array with a list of the available prefixes
*
* Configuration prefixes are used to set up configurations for n LDAP or
@@ -43,14 +45,18 @@ class Helper {
* except the default (first) server shall be connected to.
*
*/
- static public function getServerConfigurationPrefixes() {
- $referenceConfigkey = 'ldap_login_filter';
+ static public function getServerConfigurationPrefixes($activeConfigurations = false) {
+ $referenceConfigkey = 'ldap_configuration_active';
- $query = \OCP\DB::prepare('
+ $query = '
SELECT DISTINCT `configkey`
FROM `*PREFIX*appconfig`
WHERE `configkey` LIKE ?
- ');
+ ';
+ if($activeConfigurations) {
+ $query .= ' AND `configvalue` = 1';
+ }
+ $query = \OCP\DB::prepare($query);
$serverConfigs = $query->execute(array('%'.$referenceConfigkey))->fetchAll();
$prefixes = array();