summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-10-10 19:37:12 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-10-17 19:13:28 +0200
commitf64ae7510708e50a416448b4eccb6b0535f2faa6 (patch)
tree758d44a95d716712eee48f0f39b3e5459d7df81d /apps/user_ldap/js
parent7ad8319488cc35c849dba9bae15c1784acbd68d1 (diff)
downloadnextcloud-server-f64ae7510708e50a416448b4eccb6b0535f2faa6.tar.gz
nextcloud-server-f64ae7510708e50a416448b4eccb6b0535f2faa6.zip
LDAP Wizard: fix couple more or less nasty bugs aka polishing
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r--apps/user_ldap/js/settings.js39
1 files changed, 37 insertions, 2 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index 6b1f363bbaf..df5de874601 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -155,14 +155,16 @@ var LdapWizard = {
$('#'+id).val(result.changes[id]);
}
}
+ LdapWizard.functionalityCheck();
},
checkBaseDN: function() {
host = $('#ldap_host').val();
+ port = $('#ldap_port').val();
user = $('#ldap_dn').val();
pass = $('#ldap_agent_password').val();
- if(host && user && pass) {
+ if(host && port && user && pass) {
param = 'action=guessBaseDN'+
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
@@ -195,6 +197,7 @@ var LdapWizard = {
function(result) {
LdapWizard.applyChanges(result);
if($('#ldap_port').val()) {
+ LdapWizard.checkBaseDN();
$('#ldap_port').removeClass('invisible');
LdapWizard.hideInfoBox();
}
@@ -346,6 +349,29 @@ var LdapWizard = {
);
},
+ functionalityCheck: function() {
+ //criterias to enable the connection:
+ // - host, port, user filter, login filter
+ host = $('#ldap_host').val();
+ port = $('#ldap_port').val();
+ userfilter = $('#ldap_dn').val();
+ loginfilter = $('#ldap_agent_password').val();
+
+ //FIXME: activates a manually deactivated configuration.
+ if(host && port && userfilter && loginfilter) {
+ if($('#ldap_configuration_active').is(':checked')) {
+ return;
+ }
+ $('#ldap_configuration_active').prop('checked', true);
+ LdapWizard.save($('#ldap_configuration_active')[0]);
+ } else {
+ if($('#ldap_configuration_active').is(':checked')) {
+ $('#ldap_configuration_active').prop('checked', false);
+ LdapWizard.save($('#ldap_configuration_active')[0]);
+ }
+ }
+ },
+
hideInfoBox: function() {
if(LdapWizard.checkInfoShown) {
$('#ldapWizard1 .ldapWizardInfo').addClass('invisible');
@@ -362,11 +388,13 @@ var LdapWizard = {
initGroupFilter: function() {
LdapWizard.findObjectClasses('ldap_groupfilter_objectclass', 'Group');
LdapWizard.findAvailableGroups('ldap_groupfilter_groups', 'Groups');
+ LdapWizard.composeFilter('group');
LdapWizard.countGroups();
},
initLoginFilter: function() {
LdapWizard.findAttributes();
+ LdapWizard.composeFilter('login');
},
initMultiSelect: function(object, id, caption) {
@@ -384,6 +412,7 @@ var LdapWizard = {
initUserFilter: function() {
LdapWizard.findObjectClasses('ldap_userfilter_objectclass', 'User');
LdapWizard.findAvailableGroups('ldap_userfilter_groups', 'Users');
+ LdapWizard.composeFilter('user');
LdapWizard.countUsers();
},
@@ -403,7 +432,10 @@ var LdapWizard = {
|| triggerObj.id == 'ldap_dn'
|| triggerObj.id == 'ldap_agent_password') {
LdapWizard.checkPort();
- LdapWizard.checkBaseDN();
+ if($('#ldap_port').val()) {
+ //if Port is already set, check BaseDN
+ LdapWizard.checkBaseDN();
+ }
}
if(triggerObj.id == 'ldap_userlist_filter') {
@@ -442,6 +474,9 @@ var LdapWizard = {
if(originalObj == 'ldap_userfilter_objectclass'
|| originalObj == 'ldap_userfilter_groups') {
LdapWizard.composeFilter('user');
+ //when user filter is changed afterwards, login filter needs to
+ //be adjusted, too
+ LdapWizard.composeFilter('login');
} else if(originalObj == 'ldap_loginfilter_attributes') {
LdapWizard.composeFilter('login');
} else if(originalObj == 'ldap_groupfilter_objectclass'