allow to read again objectclasses and groups under certain conditions

This commit is contained in:
Arthur Schiwon 2015-01-14 15:15:55 +01:00
parent 51d783ca6e
commit 672bc28715
2 changed files with 31 additions and 2 deletions

View 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;

View 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 {