Added option to lowercase all usernames.
This resolves bug with Windows AD servers as LDAP server. Windows is case insensitve on logon requests. If users are stored camel case and logon using all lower it causes issues as OwnCloud is configured to be case sensitive. Signed-off-by: Insanemal <insanemal@gmail.com>
This commit is contained in:
parent
93502b3ef8
commit
18d8dc4757
|
@ -20,7 +20,7 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls');
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase');
|
||||
|
||||
foreach($params as $param){
|
||||
if(isset($_POST[$param])){
|
||||
|
@ -28,6 +28,9 @@ foreach($params as $param){
|
|||
}
|
||||
elseif('ldap_tls' == $param) {
|
||||
// unchecked checkboxes are not included in the post paramters
|
||||
OC_Appconfig::setValue('user_ldap', $param, 0);
|
||||
}
|
||||
elseif('ldap_nocase' == $param) {
|
||||
OC_Appconfig::setValue('user_ldap', $param, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<p><label for="ldap_display_name"><?php echo $l->t('Display Name Field');?></label><input type="text" id="ldap_display_name" name="ldap_display_name" value="<?php echo $_['ldap_display_name']; ?>" />
|
||||
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
|
||||
<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
|
||||
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Conver UID lowercase');?></label></p>
|
||||
<input type="submit" value="Save" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -34,6 +34,7 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
protected $ldap_base;
|
||||
protected $ldap_filter;
|
||||
protected $ldap_tls;
|
||||
protected $ldap_nocase;
|
||||
protected $ldap_display_name;
|
||||
|
||||
function __construct() {
|
||||
|
@ -44,6 +45,7 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
$this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
|
||||
$this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter','');
|
||||
$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
|
||||
$this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
|
||||
$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
|
||||
|
||||
if( !empty($this->ldap_host)
|
||||
|
@ -146,7 +148,13 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
// TODO ldap_get_entries() seems to lower all keys => needs review
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
if($this->ldap_nocase) {
|
||||
$users[] = strtolower($row[$ldap_display_name][0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO language specific sorting of user names
|
||||
|
|
Loading…
Reference in New Issue