Skip to content

Loading…

Ldap fixes #5532

Merged
merged 4 commits into from

4 participants

@blizzz
ownCloud member

Fixes for #5517 #5518 #5520 and #5521

Please review @DeepDiver1975 @PVince81 @bantu or others, thx.

@owncloud-bot

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1780/

@VicDeo
ownCloud member

:+1: Looks good

@DeepDiver1975
ownCloud member

:+1: looks good

@DeepDiver1975 DeepDiver1975 merged commit 5fd1f55 into master

1 check passed

Details default Merged build finished.
@DeepDiver1975 DeepDiver1975 deleted the ldap_fixes branch
@blizzz
ownCloud member

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 45 additions and 12 deletions.
  1. +28 −10 apps/user_ldap/js/settings.js
  2. +2 −2 apps/user_ldap/lib/configuration.php
  3. +15 −0 apps/user_ldap/lib/connection.php
View
38 apps/user_ldap/js/settings.js
@@ -272,13 +272,8 @@ var LdapWizard = {
if(curTabIndex == 0) {
return;
}
- if(curTabIndex == 1) {
- $('.ldap_action_back').addClass('invisible');
- }
$('#ldapSettings').tabs('option', 'active', curTabIndex - 1);
- if(curTabIndex == 3) {
- $('.ldap_action_continue').removeClass('invisible');
- }
+ LdapWizard.controlUpdate(curTabIndex - 1);
},
controlContinue: function() {
@@ -287,12 +282,26 @@ var LdapWizard = {
return;
}
$('#ldapSettings').tabs('option', 'active', 1 + curTabIndex);
- if(curTabIndex == 2) {
+ LdapWizard.controlUpdate(curTabIndex + 1);
+ },
+
+ controlUpdate: function(nextTabIndex) {
+ if(nextTabIndex == 0) {
+ $('.ldap_action_back').addClass('invisible');
+ $('.ldap_action_continue').removeClass('invisible');
+ } else
+ if(nextTabIndex == 1) {
+ $('.ldap_action_back').removeClass('invisible');
+ $('.ldap_action_continue').removeClass('invisible');
+ } else
+ if(nextTabIndex == 2) {
+ $('.ldap_action_continue').removeClass('invisible');
+ $('.ldap_action_back').removeClass('invisible');
+ } else
+ if(nextTabIndex == 3) {
//now last tab
- $('.ldap_action_continue').addClass('invisible');
- }
- if(curTabIndex == 0) {
$('.ldap_action_back').removeClass('invisible');
+ $('.ldap_action_continue').addClass('invisible');
}
},
@@ -493,12 +502,21 @@ var LdapWizard = {
},
onTabChange: function(event, ui) {
+ newTabIndex = 0;
if(ui.newTab[0].id === '#ldapWizard2') {
LdapWizard.initUserFilter();
+ newTabIndex = 1;
} else if(ui.newTab[0].id === '#ldapWizard3') {
LdapWizard.initLoginFilter();
+ newTabIndex = 2;
} else if(ui.newTab[0].id === '#ldapWizard4') {
LdapWizard.initGroupFilter();
+ newTabIndex = 3;
+ }
+
+ curTabIndex = $('#ldapSettings').tabs('option', 'active');
+ if(curTabIndex >= 0 && curTabIndex <= 3) {
+ LdapWizard.controlUpdate(newTabIndex);
}
},
View
4 apps/user_ldap/lib/configuration.php
@@ -241,7 +241,7 @@ protected function getMultiLine($varname) {
protected function setMultiLine($varname, $value) {
if(empty($value)) {
$value = '';
- } else {
+ } else if (!is_array($value)) {
$value = preg_split('/\r\n|\r|\n/', $value);
if($value === false) {
$value = '';
@@ -374,7 +374,7 @@ public function getConfigTranslationArray() {
'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch',
'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch',
'ldap_expert_username_attr' => 'ldapExpertUsernameAttr',
- 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIUserDAttr',
+ 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr',
'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr',
'has_memberof_filter_support' => 'hasMemberOfFilterSupport',
);
View
15 apps/user_ldap/lib/connection.php
@@ -39,6 +39,8 @@ class Connection extends LDAPUtility {
//settings handler
protected $configuration;
+ protected $doNotValidate = false;
+
/**
* @brief Constructor
* @param $configPrefix a string with the prefix for the configkey column (appconfig table)
@@ -57,6 +59,8 @@ public function __construct(ILDAPWrapper $ldap, $configPrefix = '', $configID =
}
$this->hasPagedResultSupport =
$this->ldap->hasPagedResultSupport();
+ $this->doNotValidate = !in_array($this->configPrefix,
+ Helper::getServerConfigurationPrefixes());
}
public function __destruct() {
@@ -88,6 +92,7 @@ public function __get($name) {
}
public function __set($name, $value) {
+ $this->doNotValidate = false;
$before = $this->configuration->$name;
$this->configuration->$name = $value;
$after = $this->configuration->$name;
@@ -201,11 +206,13 @@ public function setConfiguration($config, &$setParameters = null) {
if(is_null($setParameters)) {
$setParameters = array();
}
+ $this->doNotValidate = false;
$this->configuration->setConfiguration($config, $setParameters);
if(count($setParameters) > 0) {
$this->configured = $this->validateConfiguration();
}
+
return $this->configured;
}
@@ -401,6 +408,14 @@ private function doCriticalValidation() {
* @returns true if configuration seems OK, false otherwise
*/
private function validateConfiguration() {
+
+ if($this->doNotValidate) {
+ //don't do a validation if it is a new configuration with pure
+ //default values. Will be allowed on changes via __set or
+ //setConfiguration
+ return false;
+ }
+
// first step: "soft" checks: settings that are not really
// necessary, but advisable. If left empty, give an info message
$this->doSoftValidation();
Something went wrong with that request. Please try again.