Skip to content
Snippets Groups Projects
Commit ce9103d5 authored by Jan-Christoph Borchardt's avatar Jan-Christoph Borchardt
Browse files

Merge pull request #4426 from owncloud/ldap_settings_design

Ldap settings design
parents 12f4494d 42fc2295
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,20 @@ ...@@ -3,14 +3,20 @@
max-width: 200px; max-width: 200px;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
text-align: right;
padding-top: 9px; padding-top: 9px;
padding-right: 5px;
} }
#ldap fieldset input, #ldap fieldset textarea { #ldap fieldset input, #ldap fieldset textarea {
width: 70%; width: 60%;
display: inline-block; display: inline-block;
} }
#ldap fieldset p input[type=checkbox] {
vertical-align: bottom;
}
.ldapIndent { .ldapIndent {
margin-left: 50px; margin-left: 50px;
} }
......
...@@ -176,6 +176,13 @@ $(document).ready(function() { ...@@ -176,6 +176,13 @@ $(document).ready(function() {
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() { $('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
$('#ldap_submit').css('background', bgcolor); $('#ldap_submit').css('background', bgcolor);
}); });
//update the Label in the config chooser
caption = $('#ldap_serverconfig_chooser option:selected:first').text();
pretext = '. Server: ';
caption = caption.slice(0, caption.indexOf(pretext) + pretext.length);
caption = caption + $('#ldap_host').val();
$('#ldap_serverconfig_chooser option:selected:first').text(caption);
} else { } else {
$('#ldap_submit').css('background', '#fff'); $('#ldap_submit').css('background', '#fff');
$('#ldap_submit').effect('highlight', {'color':'#E97'}, 5000, function() { $('#ldap_submit').effect('highlight', {'color':'#E97'}, 5000, function() {
......
...@@ -70,6 +70,34 @@ class Helper { ...@@ -70,6 +70,34 @@ class Helper {
return $prefixes; return $prefixes;
} }
/**
*
* @brief determines the host for every configured connection
* @return an array with configprefix as keys
*
*/
static public function getServerConfigurationHosts() {
$referenceConfigkey = 'ldap_host';
$query = '
SELECT DISTINCT `configkey`, `configvalue`
FROM `*PREFIX*appconfig`
WHERE `appid` = \'user_ldap\'
AND `configkey` LIKE ?
';
$query = \OCP\DB::prepare($query);
$configHosts = $query->execute(array('%'.$referenceConfigkey))->fetchAll();
$result = array();
foreach($configHosts as $configHost) {
$len = strlen($configHost['configkey']) - strlen($referenceConfigkey);
$prefix = substr($configHost['configkey'], 0, $len);
$result[$prefix] = $configHost['configvalue'];
}
return $result;
}
/** /**
* @brief deletes a given saved LDAP/AD server configuration. * @brief deletes a given saved LDAP/AD server configuration.
* @param string the configuration prefix of the config to delete * @param string the configuration prefix of the config to delete
......
...@@ -44,7 +44,9 @@ OCP\Util::addstyle('user_ldap', 'settings'); ...@@ -44,7 +44,9 @@ OCP\Util::addstyle('user_ldap', 'settings');
$tmpl = new OCP\Template('user_ldap', 'settings'); $tmpl = new OCP\Template('user_ldap', 'settings');
$prefixes = \OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(); $prefixes = \OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes();
$hosts = \OCA\user_ldap\lib\Helper::getServerConfigurationHosts();
$tmpl->assign('serverConfigurationPrefixes', $prefixes); $tmpl->assign('serverConfigurationPrefixes', $prefixes);
$tmpl->assign('serverConfigurationHosts', $hosts);
// assign default values // assign default values
if(!isset($ldap)) { if(!isset($ldap)) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
$sel = ' selected'; $sel = ' selected';
foreach($_['serverConfigurationPrefixes'] as $prefix) { foreach($_['serverConfigurationPrefixes'] as $prefix) {
?> ?>
<option value="<?php p($prefix); ?>"<?php p($sel); ?>><?php p($i++); ?>. Server</option> <option value="<?php p($prefix); ?>"<?php p($sel); $sel = ''; ?>><?php p($i++); ?>. Server: <?php p($_['serverConfigurationHosts'][$prefix]); ?></option>
<?php <?php
} }
} }
...@@ -51,18 +51,15 @@ ...@@ -51,18 +51,15 @@
<p><label for="ldap_login_filter"><?php p($l->t('User Login Filter'));?></label> <p><label for="ldap_login_filter"><?php p($l->t('User Login Filter'));?></label>
<input type="text" id="ldap_login_filter" name="ldap_login_filter" <input type="text" id="ldap_login_filter" name="ldap_login_filter"
data-default="<?php p($_['ldap_login_filter_default']); ?>" data-default="<?php p($_['ldap_login_filter_default']); ?>"
title="<?php p($l->t('Defines the filter to apply, when login is attempted. %%uid replaces the username in the login action.'));?>" /> title="<?php p($l->t('Defines the filter to apply, when login is attempted. %%uid replaces the username in the login action. Example: "uid=%%uid"'));?>" /></p>
<br /><small><?php p($l->t('use %%uid placeholder, e.g. "uid=%%uid"'));?></small></p>
<p><label for="ldap_userlist_filter"><?php p($l->t('User List Filter'));?></label> <p><label for="ldap_userlist_filter"><?php p($l->t('User List Filter'));?></label>
<input type="text" id="ldap_userlist_filter" name="ldap_userlist_filter" <input type="text" id="ldap_userlist_filter" name="ldap_userlist_filter"
data-default="<?php p($_['ldap_userlist_filter_default']); ?>" data-default="<?php p($_['ldap_userlist_filter_default']); ?>"
title="<?php p($l->t('Defines the filter to apply, when retrieving users.'));?>" /> title="<?php p($l->t('Defines the filter to apply, when retrieving users (no placeholders). Example: "objectClass=person"'));?>" /></p>
<br /><small><?php p($l->t('without any placeholder, e.g. "objectClass=person".'));?></small></p>
<p><label for="ldap_group_filter"><?php p($l->t('Group Filter'));?></label> <p><label for="ldap_group_filter"><?php p($l->t('Group Filter'));?></label>
<input type="text" id="ldap_group_filter" name="ldap_group_filter" <input type="text" id="ldap_group_filter" name="ldap_group_filter"
data-default="<?php p($_['ldap_group_filter_default']); ?>" data-default="<?php p($_['ldap_group_filter_default']); ?>"
title="<?php p($l->t('Defines the filter to apply, when retrieving groups.'));?>" /> title="<?php p($l->t('Defines the filter to apply, when retrieving groups (no placeholders). Example: "objectClass=posixGroup"'));?>" /></p>
<br /><small><?php p($l->t('without any placeholder, e.g. "objectClass=posixGroup".'));?></small></p>
</fieldset> </fieldset>
<fieldset id="ldapSettings-2"> <fieldset id="ldapSettings-2">
<div id="ldapAdvancedAccordion"> <div id="ldapAdvancedAccordion">
...@@ -75,7 +72,7 @@ ...@@ -75,7 +72,7 @@
<p><label for="ldap_override_main_server"><?php p($l->t('Disable Main Server'));?></label><input type="checkbox" id="ldap_override_main_server" name="ldap_override_main_server" value="1" data-default="<?php p($_['ldap_override_main_server_default']); ?>" title="<?php p($l->t('Only connect to the replica server.'));?>" /></p> <p><label for="ldap_override_main_server"><?php p($l->t('Disable Main Server'));?></label><input type="checkbox" id="ldap_override_main_server" name="ldap_override_main_server" value="1" data-default="<?php p($_['ldap_override_main_server_default']); ?>" title="<?php p($l->t('Only connect to the replica server.'));?>" /></p>
<p><label for="ldap_tls"><?php p($l->t('Use TLS'));?></label><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1" data-default="<?php p($_['ldap_tls_default']); ?>" title="<?php p($l->t('Do not use it additionally for LDAPS connections, it will fail.'));?>" /></p> <p><label for="ldap_tls"><?php p($l->t('Use TLS'));?></label><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1" data-default="<?php p($_['ldap_tls_default']); ?>" title="<?php p($l->t('Do not use it additionally for LDAPS connections, it will fail.'));?>" /></p>
<p><label for="ldap_nocase"><?php p($l->t('Case insensitve LDAP server (Windows)'));?></label><input type="checkbox" id="ldap_nocase" name="ldap_nocase" data-default="<?php p($_['ldap_nocase_default']); ?>" value="1"<?php if (isset($_['ldap_nocase']) && ($_['ldap_nocase'])) p(' checked'); ?>></p> <p><label for="ldap_nocase"><?php p($l->t('Case insensitve LDAP server (Windows)'));?></label><input type="checkbox" id="ldap_nocase" name="ldap_nocase" data-default="<?php p($_['ldap_nocase_default']); ?>" value="1"<?php if (isset($_['ldap_nocase']) && ($_['ldap_nocase'])) p(' checked'); ?>></p>
<p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.'));?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', $theme->getName() ));?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/><small><?php p($l->t('Not recommended, use for testing only.'));?></small></p> <p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.'));?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('Not recommended, use it for testing only! If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', $theme->getName() ));?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/></p>
<p><label for="ldap_cache_ttl"><?php p($l->t('Cache Time-To-Live'));?></label><input type="number" id="ldap_cache_ttl" name="ldap_cache_ttl" title="<?php p($l->t('in seconds. A change empties the cache.'));?>" data-default="<?php p($_['ldap_cache_ttl_default']); ?>" /></p> <p><label for="ldap_cache_ttl"><?php p($l->t('Cache Time-To-Live'));?></label><input type="number" id="ldap_cache_ttl" name="ldap_cache_ttl" title="<?php p($l->t('in seconds. A change empties the cache.'));?>" data-default="<?php p($_['ldap_cache_ttl_default']); ?>" /></p>
</div> </div>
<h3><?php p($l->t('Directory Settings'));?></h3> <h3><?php p($l->t('Directory Settings'));?></h3>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment