summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-12-03 13:27:45 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-12-04 18:58:29 +0100
commit06577f1fe2d3a164b188cf303b0077f6b54b9f57 (patch)
treec3b2b6bae8f0bb071490b0529f912244424249d3
parentcc725674e058b44b0b931ed3d33aef7e0ac109c8 (diff)
downloadnextcloud-server-06577f1fe2d3a164b188cf303b0077f6b54b9f57.tar.gz
nextcloud-server-06577f1fe2d3a164b188cf303b0077f6b54b9f57.zip
LDAP Wizard: make sure auto-detected suggestions are really applied initially. Also make initial filter compilation and user counting robust against race conditions.
-rw-r--r--apps/user_ldap/js/settings.js57
1 files changed, 54 insertions, 3 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index 801de12ea94..a6bfa7549fe 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -407,6 +407,7 @@ var LdapWizard = {
if($('#rawLoginFilterContainer').hasClass('invisible')) {
$('#ldap_loginfilter_attributes').multiselect('enable');
}
+ LdapWizard.postInitLoginFilter();
},
function (result) {
//deactivate if no attributes found
@@ -443,10 +444,24 @@ var LdapWizard = {
//enable only when raw filter editing is not turned on
$('#'+multisel).multiselect('enable');
}
+ if(type == 'Users') {
+ //required for initial save
+ filter = $('#ldap_userlist_filter').val();
+ if(!filter) {
+ LdapWizard.saveMultiSelect(multisel,
+ $('#'+multisel).multiselect("getChecked"));
+ }
+ LdapWizard.userFilterAvailableGroupsHasRun = true;
+ LdapWizard.postInitUserFilter();
+ }
},
function (result) {
LdapWizard.hideSpinner('#'+multisel);
$('#'+multisel).multiselect('disable');
+ if(type == 'Users') {
+ LdapWizard.userFilterAvailableGroupsHasRun = true;
+ LdapWizard.postInitUserFilter();
+ }
}
);
},
@@ -471,9 +486,23 @@ var LdapWizard = {
LdapWizard.hideSpinner('#'+multisel);
LdapWizard.applyChanges(result);
$('#'+multisel).multiselect('refresh');
+ if(type == 'User') {
+ //required for initial save
+ filter = $('#ldap_userlist_filter').val();
+ if(!filter) {
+ LdapWizard.saveMultiSelect(multisel,
+ $('#'+multisel).multiselect("getChecked"));
+ }
+ LdapWizard.userFilterObjectClassesHasRun = true;
+ LdapWizard.postInitUserFilter();
+ }
},
function (result) {
LdapWizard.hideSpinner('#'+multisel);
+ if(type == 'User') {
+ LdapWizard.userFilterObjectClassesHasRun = true;
+ LdapWizard.postInitUserFilter();
+ }
//TODO: error handling
}
);
@@ -536,11 +565,19 @@ var LdapWizard = {
LdapWizard.countGroups();
},
+ /** init login filter tab section **/
+
initLoginFilter: function() {
LdapWizard.regardFilterMode('Login');
LdapWizard.findAttributes();
},
+ postInitLoginFilter: function() {
+ LdapWizard.composeFilter('login');
+ },
+
+ /** end of init user filter tab section **/
+
initMultiSelect: function(object, id, caption) {
object.multiselect({
header: false,
@@ -553,13 +590,29 @@ var LdapWizard = {
});
},
+ /** init user filter tab section **/
+
+ userFilterObjectClassesHasRun: false,
+ userFilterAvailableGroupsHasRun: false,
+
initUserFilter: function() {
+ LdapWizard.userFilterObjectClassesHasRun = false;
+ LdapWizard.userFilterAvailableGroupsHasRun = false;
LdapWizard.regardFilterMode('User');
LdapWizard.findObjectClasses('ldap_userfilter_objectclass', 'User');
LdapWizard.findAvailableGroups('ldap_userfilter_groups', 'Users');
- LdapWizard.countUsers();
},
+ postInitUserFilter: function() {
+ if(LdapWizard.userFilterObjectClassesHasRun
+ && LdapWizard.userFilterAvailableGroupsHasRun) {
+ LdapWizard.composeFilter('user');
+ LdapWizard.countUsers();
+ }
+ },
+
+ /** end of init user filter tab section **/
+
onTabChange: function(event, ui) {
newTabIndex = 0;
if(ui.newTab[0].id === '#ldapWizard2') {
@@ -626,8 +679,6 @@ var LdapWizard = {
} else if(mode == LdapWizard.filterModeAssisted
&& !$('#raw'+subject+'FilterContainer').hasClass('invisible')) {
LdapWizard['toggleRaw'+subject+'Filter']();
- } else {
- c = $('#raw'+subject+'FilterContainer').hasClass('invisible');
}
},
function (result) {