diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-10-08 18:27:36 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-10-17 19:13:28 +0200 |
commit | e903db7887fe9ffc61791610d098dd623552da5d (patch) | |
tree | 1c2f060bc949a3006b7a50ad0713a0d5a6db3516 /apps/user_ldap/js | |
parent | 5c99645f7df70c930c3fbfca3de1a446eca66b2d (diff) | |
download | nextcloud-server-e903db7887fe9ffc61791610d098dd623552da5d.tar.gz nextcloud-server-e903db7887fe9ffc61791610d098dd623552da5d.zip |
LDAP Wizard: create user list filter, show number of user that will have access to OC
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r-- | apps/user_ldap/js/settings.js | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 837b79e329c..d3c7aeea4f7 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -127,6 +127,7 @@ var LdapConfiguration = { var LdapWizard = { checkPortInfoShown: false, saveBlacklist: {}, + userFilterGroupSelectState: 'enable', ajax: function(param, fnOnSuccess, fnOnError) { $.post( @@ -148,7 +149,11 @@ var LdapWizard = { //no need to blacklist multiselect LdapWizard.saveBlacklist[id] = true; } - $('#'+id).val(result.changes[id]); + if(id.indexOf('count') > 0) { + $('#'+id).text(result.changes[id]); + } else { + $('#'+id).val(result.changes[id]); + } } }, @@ -202,6 +207,40 @@ var LdapWizard = { } }, + composeFilter: function(type) { + if(type == 'user') { + action = 'getUserListFilter'; + } + + param = 'action='+action+ + '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); + + LdapWizard.ajax(param, + function(result) { + LdapWizard.applyChanges(result); + LdapWizard.countUsers(); + }, + function (result) { + // error handling + } + ); + }, + + countUsers: function() { + param = 'action=countUsers'+ + '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); + + LdapWizard.ajax(param, + function(result) { + LdapWizard.applyChanges(result); +// alert(result.changes['ldap_user_count']); + }, + function (result) { + // error handling + } + ); + }, + findAvailableGroups: function() { param = 'action=determineGroups'+ '&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); @@ -273,6 +312,7 @@ var LdapWizard = { initUserFilter: function() { LdapWizard.findObjectClasses(); LdapWizard.findAvailableGroups(); + LdapWizard.countUsers(); }, onTabChange: function(event, ui) { @@ -289,6 +329,10 @@ var LdapWizard = { LdapWizard.checkPort(); LdapWizard.checkBaseDN(); } + + if(triggerObj.id == 'ldap_userlist_filter') { + LdapWizard.countUsers(); + } }, save: function(inputObj) { @@ -305,6 +349,10 @@ var LdapWizard = { values = values + "\n" + resultObj[i].value; } LdapWizard._save($('#'+originalObj)[0], $.trim(values)); + if(originalObj == 'ldap_userfilter_objectclass' + || originalObj == 'ldap_userfilter_groups') { + LdapWizard.composeFilter('user'); + } }, _save: function(object, value) { @@ -330,6 +378,23 @@ var LdapWizard = { $('#ldapWizard1 .ldapWizardInfo').text(t('user_ldap', text)); $('#ldapWizard1 .ldapWizardInfo').removeClass('invisible'); LdapWizard.checkInfoShown = true; + }, + + toggleRawUserFilter: function() { + if($('#rawUserFilterContainer').hasClass('invisible')) { + $('#rawUserFilterContainer').removeClass('invisible'); + $('#ldap_userfilter_objectclass').multiselect('disable'); + if($('#ldap_userfilter_groups').multiselect().attr('disabled') == 'disabled') { + userFilterGroupSelectState = 'disable'; + } else { + userFilterGroupSelectState = 'enable'; + } + $('#ldap_userfilter_groups').multiselect('disable'); + } else { + $('#rawUserFilterContainer').addClass('invisible'); + $('#ldap_userfilter_group').multiselect(userFilterGroupSelectState); + $('#ldap_userfilter_objectclass').multiselect('enable'); + } } }; @@ -346,6 +411,7 @@ $(document).ready(function() { 'ldap_userfilter_objectclass', t('user_ldap', 'Select object classes')); $('.lwautosave').change(function() { LdapWizard.save(this); }); + $('#toggleRawUserFilter').click(LdapWizard.toggleRawUserFilter); LdapConfiguration.refreshConfig(); $('#ldap_action_test_connection').click(function(event){ event.preventDefault(); |