Merge pull request #5772 from owncloud/fix5741
LDAP Wizard: introduce configuration status indicator, fixes #5741
This commit is contained in:
commit
cb968c77d1
|
@ -109,3 +109,21 @@ select[multiple=multiple] + button {
|
|||
min-width: 40%;
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
.ldap_config_state_indicator_sign {
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
.ldap_config_state_indicator_sign.success {
|
||||
background: #37ce02;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.ldap_config_state_indicator_sign.error {
|
||||
background: #ce3702;
|
||||
}
|
||||
|
||||
.ldap_grey {
|
||||
color: #777;
|
||||
}
|
|
@ -103,6 +103,20 @@ var LdapConfiguration = {
|
|||
);
|
||||
},
|
||||
|
||||
testConfiguration: function(onSuccess, onError) {
|
||||
$.post(
|
||||
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
||||
$('#ldap').serialize(),
|
||||
function (result) {
|
||||
if (result.status === 'success') {
|
||||
onSuccess(result);
|
||||
} else {
|
||||
onError(result);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
clearMappings: function(mappingSubject) {
|
||||
$.post(
|
||||
OC.filePath('user_ldap','ajax','clearMappings.php'),
|
||||
|
@ -187,6 +201,7 @@ var LdapWizard = {
|
|||
user = $('#ldap_dn').val();
|
||||
pass = $('#ldap_agent_password').val();
|
||||
|
||||
//FIXME: determine base dn with anonymous access
|
||||
if(host && port && user && pass) {
|
||||
param = 'action=guessBaseDN'+
|
||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||
|
@ -205,7 +220,7 @@ var LdapWizard = {
|
|||
function (result) {
|
||||
LdapWizard.hideSpinner('#ldap_base');
|
||||
LdapWizard.showInfoBox('Please specify a Base DN');
|
||||
$('#ldap_base').prop('disabled', false);
|
||||
LdapWizard.showInfoBox('Could not determine Base DN');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -234,7 +249,7 @@ var LdapWizard = {
|
|||
function (result) {
|
||||
LdapWizard.hideSpinner('#ldap_port');
|
||||
$('#ldap_port').prop('disabled', false);
|
||||
LdapWizard.showInfoBox('Please specify the Port');
|
||||
LdapWizard.showInfoBox('Please specify the port');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -428,14 +443,16 @@ var LdapWizard = {
|
|||
|
||||
functionalityCheck: function() {
|
||||
//criterias to enable the connection:
|
||||
// - host, port, user filter, login filter
|
||||
// - host, port, basedn, user filter, login filter
|
||||
host = $('#ldap_host').val();
|
||||
port = $('#ldap_port').val();
|
||||
userfilter = $('#ldap_dn').val();
|
||||
loginfilter = $('#ldap_agent_password').val();
|
||||
base = $('#ldap_base').val();
|
||||
userfilter = $('#ldap_userlist_filter').val();
|
||||
loginfilter = $('#ldap_login_filter').val();
|
||||
|
||||
//FIXME: activates a manually deactivated configuration.
|
||||
if(host && port && userfilter && loginfilter) {
|
||||
if(host && port && base && userfilter && loginfilter) {
|
||||
LdapWizard.updateStatusIndicator(true);
|
||||
if($('#ldap_configuration_active').is(':checked')) {
|
||||
return;
|
||||
}
|
||||
|
@ -446,6 +463,7 @@ var LdapWizard = {
|
|||
$('#ldap_configuration_active').prop('checked', false);
|
||||
LdapWizard.save($('#ldap_configuration_active')[0]);
|
||||
}
|
||||
LdapWizard.updateStatusIndicator(false);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -463,6 +481,7 @@ var LdapWizard = {
|
|||
|
||||
init: function() {
|
||||
LdapWizard.basicStatusCheck();
|
||||
LdapWizard.functionalityCheck();
|
||||
},
|
||||
|
||||
initGroupFilter: function() {
|
||||
|
@ -543,6 +562,7 @@ var LdapWizard = {
|
|||
|
||||
if($('#ldapSettings').tabs('option', 'active') == 0) {
|
||||
LdapWizard.basicStatusCheck();
|
||||
LdapWizard.functionalityCheck();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -643,6 +663,38 @@ var LdapWizard = {
|
|||
'#ldap_userfilter_groups',
|
||||
'userFilterGroupSelectState'
|
||||
);
|
||||
},
|
||||
|
||||
updateStatusIndicator: function(isComplete) {
|
||||
if(isComplete) {
|
||||
LdapConfiguration.testConfiguration(
|
||||
//onSuccess
|
||||
function(result) {
|
||||
$('.ldap_config_state_indicator').text(t('user_ldap',
|
||||
'Configuration OK'
|
||||
));
|
||||
$('.ldap_config_state_indicator').addClass('ldap_grey');
|
||||
$('.ldap_config_state_indicator_sign').removeClass('error');
|
||||
$('.ldap_config_state_indicator_sign').addClass('success');
|
||||
},
|
||||
//onError
|
||||
function(result) {
|
||||
$('.ldap_config_state_indicator').text(t('user_ldap',
|
||||
'Configuration incorrect'
|
||||
));
|
||||
$('.ldap_config_state_indicator').removeClass('ldap_grey');
|
||||
$('.ldap_config_state_indicator_sign').addClass('error');
|
||||
$('.ldap_config_state_indicator_sign').removeClass('success');
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$('.ldap_config_state_indicator').text(t('user_ldap',
|
||||
'Configuration incomplete'
|
||||
));
|
||||
$('.ldap_config_state_indicator').removeClass('ldap_grey');
|
||||
$('.ldap_config_state_indicator_sign').removeClass('error');
|
||||
$('.ldap_config_state_indicator_sign').removeClass('success');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -681,21 +733,20 @@ $(document).ready(function() {
|
|||
});
|
||||
$('.ldap_action_test_connection').click(function(event){
|
||||
event.preventDefault();
|
||||
$.post(
|
||||
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
||||
$('#ldap').serialize(),
|
||||
function (result) {
|
||||
if (result.status === 'success') {
|
||||
OC.dialogs.alert(
|
||||
result.message,
|
||||
t('user_ldap', 'Connection test succeeded')
|
||||
);
|
||||
} else {
|
||||
OC.dialogs.alert(
|
||||
result.message,
|
||||
t('user_ldap', 'Connection test failed')
|
||||
);
|
||||
}
|
||||
LdapConfiguration.testConfiguration(
|
||||
//onSuccess
|
||||
function(result) {
|
||||
OC.dialogs.alert(
|
||||
result.message,
|
||||
t('user_ldap', 'Connection test succeeded')
|
||||
);
|
||||
},
|
||||
//onError
|
||||
function(result) {
|
||||
OC.dialogs.alert(
|
||||
result.message,
|
||||
t('user_ldap', 'Connection test failed')
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<div class="ldapWizardControls">
|
||||
<span class="ldap_config_state_indicator"></span> <span class="ldap_config_state_indicator_sign"></span>
|
||||
<button class="ldap_action_back invisible" name="ldap_action_back"
|
||||
type="button">
|
||||
<?php p($l->t('Back'));?>
|
||||
|
@ -10,6 +11,6 @@
|
|||
target="_blank">
|
||||
<img src="<?php print_unescaped(OCP\Util::imagePath('', 'actions/info.png')); ?>"
|
||||
style="height:1.75ex" />
|
||||
<?php p($l->t('Help'));?>
|
||||
<span class="ldap_grey"><?php p($l->t('Help'));?></span>
|
||||
</a>
|
||||
</div>
|
Loading…
Reference in New Issue