1
0
mirror of https://github.com/moparisthebest/user_sql synced 2024-11-21 08:45:02 -05:00

Add option for forcing appending of default domain

This commit is contained in:
Andreas Boehler 2016-12-30 14:47:48 +01:00
parent cfa695fcb1
commit 424243a631
6 changed files with 28 additions and 1 deletions

View File

@ -118,6 +118,10 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'true');
}
elseif($param === 'set_force_default_domain')
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_force_default_domain'.$domain, 'true');
}
else
{
\OC::$server->getConfig()->setAppValue('user_sql', $param.'_'.$domain, $_POST[$param]);
@ -140,6 +144,10 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'false');
}
elseif($param === 'set_force_default_domain')
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_force_default_domain'.$domain, 'false');
}
}
}
$response->setData(array('status' => 'success',

View File

@ -4,7 +4,7 @@
<name>SQL user backend</name>
<summary>Authenticate Users by SQL</summary>
<description>Authenticate Users by SQL</description>
<version>2.3.2</version>
<version>2.3.3</version>
<licence>agpl</licence>
<author>Andreas Boehler &lt;dev (at) aboehler
(dot) at &gt;</author>

View File

@ -285,6 +285,13 @@ user_sql.loadDomainSettings = function(domain)
else
$('#' + key).prop('checked', false);
}
else if(key == 'set_force_default_domain')
{
if(data.settings[key] == 'true')
$('#' + key).prop('checked', true);
else
$('#' + key).prop('checked', false);
}
else
{
$('#' + key).val(data.settings[key]);

View File

@ -59,6 +59,7 @@ class Helper {
'set_active_invert',
'set_allow_pwchange',
'set_default_domain',
'set_force_default_domain',
'set_strip_domain',
'set_crypt_type',
'set_mail_sync_mode',

View File

@ -119,6 +119,12 @@ $cfgClass = $ocVersion >= 7 ? 'section' : 'personalblock';
<em><?php p($l -> t('Append this string, e.g. a domain name, to each user name. The @-sign is automatically inserted.')); ?></em>
</p>
<p><label for="set_force_default_domain"><?php p($l -> t('Force appending of default domain')); ?></label><input type="checkbox" id="set_force_default_domain" name="set_force_default_domain" value="1"><?php
if($_['set_force_default_domain'])
p(' checked');
?> /><br>
<em><?php p($l -> t("Always append the default domain, even if the user entered a domain name")); ?></em></p>
<p><label for="set_strip_domain"><?php p($l -> t('Strip Domain Part from Username')); ?></label><input type="checkbox" id="set_strip_domain" name="set_strip_domain" value="1"<?php
if($_['set_strip_domain'])
p(' checked');

View File

@ -130,6 +130,11 @@ class OC_USER_SQL extends \OC_User_Backend implements \OCP\IUserBackend, \OCP\Us
if($this -> settings['set_default_domain'] !== '')
{
\OCP\Util::writeLog('OC_USER_SQL', "Append default domain: ".$this -> settings['set_default_domain'], \OCP\Util::DEBUG);
if($this -> settings['set_force_default_domain'] === 'true')
{
$uid = explode("@", $uid);
$uid = $uid[0];
}
if(strpos($uid, '@') === false)
{
$uid .= "@" . $this -> settings['set_default_domain'];