From 58aad1096f2370adeb76f6ef580ba809be13ea29 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 8 Nov 2013 17:48:29 +0100 Subject: LDAP Wizard: keep Base DN always visible --- apps/user_ldap/js/settings.js | 5 ----- apps/user_ldap/templates/part.wizard-server.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 3abec1e232e..721674ee8e4 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -197,13 +197,11 @@ var LdapWizard = { LdapWizard.applyChanges(result); LdapWizard.hideSpinner('#ldap_base'); if($('#ldap_base').val()) { - $('#ldap_base').removeClass('invisible'); LdapWizard.hideInfoBox(); } }, function (result) { LdapWizard.hideSpinner('#ldap_base'); - $('#ldap_base').removeClass('invisible'); LdapWizard.showInfoBox('Please specify a port'); } ); @@ -464,9 +462,6 @@ var LdapWizard = { if($('#ldap_port').val()) { $('#ldap_port').removeClass('invisible'); } - if($('#ldap_base').val()) { - $('#ldap_base').removeClass('invisible'); - } LdapWizard.basicStatusCheck(); }, diff --git a/apps/user_ldap/templates/part.wizard-server.php b/apps/user_ldap/templates/part.wizard-server.php index 01dd8d0fcb2..82ee9b2b23a 100644 --- a/apps/user_ldap/templates/part.wizard-server.php +++ b/apps/user_ldap/templates/part.wizard-server.php @@ -56,7 +56,7 @@
-- cgit v1.2.3 From ea9f392f4e571bac223f0e8b0c5ee122b16ac76a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 11 Nov 2013 13:36:28 +0100 Subject: LDAP Wizard: improve check for Agent DN and Credentials --- apps/user_ldap/lib/wizard.php | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 9428a98e29c..7e8ea0696a7 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -63,8 +63,6 @@ class Wizard extends LDAPUtility { public function countGroups() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -98,8 +96,6 @@ class Wizard extends LDAPUtility { public function countUsers() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', 'ldapUserFilter', ))) { @@ -130,8 +126,6 @@ class Wizard extends LDAPUtility { public function determineAttributes() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', 'ldapUserFilter', ))) { @@ -160,8 +154,6 @@ class Wizard extends LDAPUtility { private function getUserAttributes() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', 'ldapUserFilter', ))) { @@ -214,8 +206,6 @@ class Wizard extends LDAPUtility { private function determineGroups($dbkey, $confkey, $testMemberOf = true) { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -242,8 +232,6 @@ class Wizard extends LDAPUtility { public function determineGroupMemberAssoc() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapGroupFilter', ))) { return false; @@ -266,8 +254,6 @@ class Wizard extends LDAPUtility { public function determineGroupObjectClasses() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -294,8 +280,6 @@ class Wizard extends LDAPUtility { public function determineUserObjectClasses() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -322,8 +306,6 @@ class Wizard extends LDAPUtility { public function getGroupFilter() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -337,8 +319,6 @@ class Wizard extends LDAPUtility { public function getUserListFilter() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', ))) { return false; @@ -355,13 +335,12 @@ class Wizard extends LDAPUtility { public function getUserLoginFilter() { if(!$this->checkRequirements(array('ldapHost', 'ldapPort', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapBase', 'ldapUserFilter', ))) { return false; } + $filter = $this->composeLdapFilter(self::LFILTER_LOGIN); if(!$filter) { throw new \Exception('Cannot create filter'); @@ -377,8 +356,6 @@ class Wizard extends LDAPUtility { */ public function guessPortAndTLS() { if(!$this->checkRequirements(array('ldapHost', - 'ldapAgentName', - 'ldapAgentPassword' ))) { return false; } @@ -418,8 +395,6 @@ class Wizard extends LDAPUtility { */ public function guessBaseDN() { if(!$this->checkRequirements(array('ldapHost', - 'ldapAgentName', - 'ldapAgentPassword', 'ldapPort', ))) { return false; @@ -799,7 +774,22 @@ class Wizard extends LDAPUtility { throw new \Exception($error); } + /** + * @brief checks whether a valid combination of agent and password has been + * provided (either two values or nothing for anonymous connect) + * @return boolean, true if everything is fine, false otherwise + * + */ + private function checkAgentRequirements() { + $agent = $this->configuration->ldapAgentName; + $pwd = $this->configuration->ldapAgentPassword; + + return ( (!empty($agent) && !empty($pwd)) + || (empty($agent) && empty($pwd))); + } + private function checkRequirements($reqs) { + $this->checkAgentRequirements(); foreach($reqs as $option) { $value = $this->configuration->$option; if(empty($value)) { -- cgit v1.2.3 From da61c6ef72abd54d98e9b1aa4300dba6a0eff3f0 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 11 Nov 2013 15:16:54 +0100 Subject: LDAP Wizard: determine port without credentials. don't hide the port input field --- apps/user_ldap/js/settings.js | 19 +++++++++---------- apps/user_ldap/lib/wizard.php | 4 ++-- apps/user_ldap/templates/part.wizard-server.php | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 721674ee8e4..6496c6aee59 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -202,7 +202,7 @@ var LdapWizard = { }, function (result) { LdapWizard.hideSpinner('#ldap_base'); - LdapWizard.showInfoBox('Please specify a port'); + LdapWizard.showInfoBox('Please specify a Base DN'); } ); } @@ -210,28 +210,28 @@ var LdapWizard = { checkPort: function() { host = $('#ldap_host').val(); - user = $('#ldap_dn').val(); - pass = $('#ldap_agent_password').val(); + port = $('#ldap_port').val(); - if(host && user && pass) { + if(host && !port) { param = 'action=guessPortAndTLS'+ '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); LdapWizard.showSpinner('#ldap_port'); + $('#ldap_port').prop('disabled', 'disabled'); LdapWizard.ajax(param, function(result) { LdapWizard.applyChanges(result); LdapWizard.hideSpinner('#ldap_port'); if($('#ldap_port').val()) { LdapWizard.checkBaseDN(); - $('#ldap_port').removeClass('invisible'); + $('#ldap_port').prop('disabled', false); LdapWizard.hideInfoBox(); } }, function (result) { LdapWizard.hideSpinner('#ldap_port'); - $('#ldap_port').removeClass('invisible'); - LdapWizard.showInfoBox('Please specify the BaseDN'); + $('#ldap_port').prop('disabled', false); + LdapWizard.showInfoBox('Please specify the Port'); } ); } @@ -459,9 +459,6 @@ var LdapWizard = { }, init: function() { - if($('#ldap_port').val()) { - $('#ldap_port').removeClass('invisible'); - } LdapWizard.basicStatusCheck(); }, @@ -516,6 +513,8 @@ var LdapWizard = { }, processChanges: function(triggerObj) { + LdapWizard.hideInfoBox(); + if(triggerObj.id == 'ldap_host' || triggerObj.id == 'ldap_port' || triggerObj.id == 'ldap_dn' diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 7e8ea0696a7..0b2a6a540ff 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -995,9 +995,9 @@ class Wizard extends LDAPUtility { //In case the port is already provided, we will check this first if($port > 0) { $hostInfo = parse_url($host); - if(is_array($hostInfo) + if(!(is_array($hostInfo) && isset($hostInfo['scheme']) - && stripos($hostInfo['scheme'], 'ldaps') === false) { + && stripos($hostInfo['scheme'], 'ldaps') !== false)) { $portSettings[] = array('port' => $port, 'tls' => true); } $portSettings[] =array('port' => $port, 'tls' => false); diff --git a/apps/user_ldap/templates/part.wizard-server.php b/apps/user_ldap/templates/part.wizard-server.php index 82ee9b2b23a..fde7c36cdd1 100644 --- a/apps/user_ldap/templates/part.wizard-server.php +++ b/apps/user_ldap/templates/part.wizard-server.php @@ -32,7 +32,7 @@ />
-- cgit v1.2.3 From 082357a670de9af9bb1418b2b227f44a381ecc99 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 11 Nov 2013 19:25:20 +0100 Subject: LDAP Wizard: remove ugly whitespace where it should not be --- apps/user_ldap/templates/settings.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 22aab0186f7..feb5ac6385d 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -20,8 +20,7 @@

t('Connection Settings'));?>

-

- " />

-- cgit v1.2.3 From 550f2d0089739c6371059a356311d54dbcc73255 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 11 Nov 2013 19:27:38 +0100 Subject: LDAP Wizard: make UI behaviour more consistent and more pleasant when determining Base DN --- apps/user_ldap/css/settings.css | 8 ++------ apps/user_ldap/js/settings.js | 5 ++++- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'apps') diff --git a/apps/user_ldap/css/settings.css b/apps/user_ldap/css/settings.css index 41578e91b69..be03419c2de 100644 --- a/apps/user_ldap/css/settings.css +++ b/apps/user_ldap/css/settings.css @@ -3,13 +3,9 @@ width: 60%; } -.tablecell { - display: table-cell !important; - white-space: nowrap; -} - .tablerow { display: table-row; + white-space: nowrap; } .tablerow input, .tablerow textarea { @@ -78,6 +74,7 @@ .wizSpinner { height: 15px; + margin: 0.3em; } .ldapSettingControls { @@ -100,7 +97,6 @@ #ldap fieldset input, #ldap fieldset textarea { width: 60%; - display: inline-block; } #ldap fieldset p input[type=checkbox] { diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 6496c6aee59..dcaeb70b57f 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -192,6 +192,7 @@ var LdapWizard = { '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); LdapWizard.showSpinner('#ldap_base'); + $('#ldap_base').prop('disabled', 'disabled'); LdapWizard.ajax(param, function(result) { LdapWizard.applyChanges(result); @@ -199,10 +200,12 @@ var LdapWizard = { if($('#ldap_base').val()) { LdapWizard.hideInfoBox(); } + $('#ldap_base').prop('disabled', false); }, function (result) { LdapWizard.hideSpinner('#ldap_base'); LdapWizard.showInfoBox('Please specify a Base DN'); + $('#ldap_base').prop('disabled', false); } ); } @@ -514,7 +517,7 @@ var LdapWizard = { processChanges: function(triggerObj) { LdapWizard.hideInfoBox(); - + if(triggerObj.id == 'ldap_host' || triggerObj.id == 'ldap_port' || triggerObj.id == 'ldap_dn' -- cgit v1.2.3