$('#'+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();
function(result) {
LdapWizard.applyChanges(result);
if($('#ldap_port').val()) {
+ LdapWizard.checkBaseDN();
$('#ldap_port').removeClass('invisible');
LdapWizard.hideInfoBox();
}
);
},
+ 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');
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) {
initUserFilter: function() {
LdapWizard.findObjectClasses('ldap_userfilter_objectclass', 'User');
LdapWizard.findAvailableGroups('ldap_userfilter_groups', 'Users');
+ LdapWizard.composeFilter('user');
LdapWizard.countUsers();
},
|| 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') {
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'
public function getDefaults() {
return array(
'ldap_host' => '',
- 'ldap_port' => '389',
+ 'ldap_port' => '',
'ldap_backup_host' => '',
'ldap_backup_port' => '',
'ldap_override_main_server' => '',
'ldap_base' => '',
'ldap_base_users' => '',
'ldap_base_groups' => '',
- 'ldap_userlist_filter' => 'objectClass=person',
+ 'ldap_userlist_filter' => '',
'ldap_userfilter_objectclass' => '',
'ldap_userfilter_groups' => '',
'ldap_login_filter' => 'uid=%uid',
'ldap_loginfilter_email' => 0,
'ldap_loginfilter_username' => 1,
'ldap_loginfilter_attributes' => '',
- 'ldap_group_filter' => 'objectClass=posixGroup',
+ 'ldap_group_filter' => '',
'ldap_groupfilter_objectclass' => '',
'ldap_groupfilter_groups' => '',
'ldap_display_name' => 'displayName',
'ldap_override_uuid_attribute' => 0,
'home_folder_naming_rule' => '',
'ldap_turn_off_cert_check' => 0,
- 'ldap_configuration_active' => 1,
+ 'ldap_configuration_active' => 0,
'ldap_attributes_for_user_search' => '',
'ldap_attributes_for_group_search' => '',
'ldap_expert_username_attr' => '',
const LFILTER_USER_LIST = 3;
const LFILTER_GROUP_LIST = 4;
+ const LDAP_NW_TIMEOUT = 4;
+
/**
* @brief Constructor
* @param $configuration an instance of Configuration
if($testMemberOf) {
$this->configuration->hasMemberOfFilterSupport = $this->testMemberOf();
+ $this->result->markChange();
if(!$this->configuration->hasMemberOfFilterSupport) {
throw new \Exception('memberOf is not supported by the server');
}
}
$this->checkHost();
$portSettings = $this->getPortSettingsToTry();
- file_put_contents('/tmp/ps', print_r($portSettings, true).PHP_EOL, FILE_APPEND);
if(!is_array($portSettings)) {
throw new \Exception(print_r($portSettings, true));
\OCP\Util::writeLog('user_ldap', 'Wiz: Setting LDAP Options ', \OCP\Util::DEBUG);
//set LDAP options
- if($this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3)) {
- if($tls) {
- $this->ldap->startTls($cr);
- }
+ $a = $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
+ $c = $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
+ if($tls) {
+ $this->ldap->startTls($cr);
}
\OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \OCP\Util::DEBUG);
//pre-select objectclass with most result entries
$maxEntryObjC = str_replace($p, '', $maxEntryObjC);
$this->applyFind($dbkey, $maxEntryObjC);
-// $this->result->addChange($dbkey, $maxEntryObjC);
+ $this->result->addChange($dbkey, $maxEntryObjC);
}
return $availableFeatures;
$this->configuration->ldapHost.':'.$this->configuration->ldapPort,
$this->configuration->ldapPort);
- if($this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3)) {
- if($this->configuration->ldapTLS === 1) {
- $this->ldap->startTls($cr);
- }
+ $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
+ $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
+ if($this->configuration->ldapTLS === 1) {
+ $this->ldap->startTls($cr);
}
$lo = @$this->ldap->bind($cr,
$tmpl->assign('tabs', $wizardHtml);
$tmpl->assign('toc', $toc);
+$tmpl->assign('settingControls', $sControls);
// assign default values
$config = new \OCA\user_ldap\lib\Configuration('', false);