]> source.dussan.org Git - nextcloud-server.git/commitdiff
allow to read again objectclasses and groups under certain conditions
authorArthur Schiwon <blizzz@owncloud.com>
Wed, 14 Jan 2015 14:15:55 +0000 (15:15 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Wed, 14 Jan 2015 14:15:55 +0000 (15:15 +0100)
apps/user_ldap/js/ldapFilter.js
apps/user_ldap/js/settings.js

index c77995e0dee1ef6303ab2f149d02740f4be2769c..c546e942d072cb61e3fc1766eb19383b9830c0e8 100644 (file)
@@ -19,6 +19,8 @@ function LdapFilter(target, determineModeCallback) {
 
 LdapFilter.prototype.activate = function() {
        if(this.activated) {
+               // might be necessary, if configuration changes happened.
+               this.findFeatures();
                return;
        }
        this.activated = true;
@@ -136,8 +138,15 @@ LdapFilter.prototype.unlock = function() {
        }
 };
 
+/**
+ * resets this.foundFeatures so that LDAP queries can be fired again to retrieve
+ * objectClasses, groups, etc.
+ */
+LdapFilter.prototype.reAllowFeatureLookup = function () {
+       this.foundFeatures = false;
+};
+
 LdapFilter.prototype.findFeatures = function() {
-       //TODO: reset this.foundFeatures when any base DN changes
        if(!this.foundFeatures && !this.locked && this.mode === LdapWizard.filterModeAssisted) {
                this.foundFeatures = true;
                var objcEl, avgrEl;
index 3372613b941363d25d2ed7b293c5f4f6942ea4b4..2a8fedf5dde9274349303e0f6be58ed1478f910d 100644 (file)
@@ -149,6 +149,7 @@ var LdapWizard = {
        loginFilter: false,
        groupFilter: false,
        ajaxRequests: {},
+       lastTestSuccessful: true,
 
        ajax: function(param, fnOnSuccess, fnOnError, reqID) {
                if(!_.isUndefined(reqID)) {
@@ -619,6 +620,7 @@ var LdapWizard = {
                LdapWizard.detectorsRunInXPMode = 0;
                LdapWizard.instantiateFilters();
                LdapWizard.admin.setExperienced($('#ldap_experienced_admin').is(':checked'));
+               LdapWizard.lastTestSuccessful = true;
                LdapWizard.basicStatusCheck();
                LdapWizard.functionalityCheck();
                LdapWizard.isConfigurationActiveControlLocked = false;
@@ -760,7 +762,19 @@ var LdapWizard = {
                }
        },
 
-       processChanges: function(triggerObj) {
+       /**
+        * allows UserFilter, LoginFilter and GroupFilter to lookup objectClasses
+        * and similar again. This should be called after essential changes, e.g.
+        * Host or BaseDN changes, or positive functionality check
+        *
+        */
+       allowFilterFeatureSearch: function () {
+               LdapWizard.userFilter.reAllowFeatureLookup();
+               LdapWizard.loginFilter.reAllowFeatureLookup();
+               LdapWizard.groupFilter.reAllowFeatureLookup();
+       },
+
+       processChanges: function (triggerObj) {
                LdapWizard.hideInfoBox();
 
                if(triggerObj.id === 'ldap_host'
@@ -771,6 +785,7 @@ var LdapWizard = {
                        if($('#ldap_port').val()) {
                                //if Port is already set, check BaseDN
                                LdapWizard.checkBaseDN();
+                               LdapWizard.allowFilterFeatureSearch();
                        }
                }
 
@@ -1002,6 +1017,10 @@ var LdapWizard = {
                                        $('.ldap_config_state_indicator').addClass('ldap_grey');
                                        $('.ldap_config_state_indicator_sign').removeClass('error');
                                        $('.ldap_config_state_indicator_sign').addClass('success');
+                                       if(!LdapWizard.lastTestSuccessful) {
+                                               LdapWizard.lastTestSuccessful = true;
+                                               LdapWizard.allowFilterFeatureSearch();
+                                       }
                                },
                                //onError
                                function(result) {
@@ -1011,6 +1030,7 @@ var LdapWizard = {
                                        $('.ldap_config_state_indicator').removeClass('ldap_grey');
                                        $('.ldap_config_state_indicator_sign').addClass('error');
                                        $('.ldap_config_state_indicator_sign').removeClass('success');
+                                       LdapWizard.lastTestSuccessful = false;
                                }
                        );
                } else {