Supervision support added.
This commit is contained in:
@@ -114,6 +114,10 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
|
|||||||
{
|
{
|
||||||
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'true');
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'true');
|
||||||
}
|
}
|
||||||
|
elseif($param === 'set_supervisor')
|
||||||
|
{
|
||||||
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_supervisor_'.$domain, 'true');
|
||||||
|
}
|
||||||
elseif($param === 'set_enable_gethome')
|
elseif($param === 'set_enable_gethome')
|
||||||
{
|
{
|
||||||
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'true');
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'true');
|
||||||
@@ -136,6 +140,10 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
|
|||||||
{
|
{
|
||||||
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'false');
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'false');
|
||||||
}
|
}
|
||||||
|
elseif($param === 'set_supervisor')
|
||||||
|
{
|
||||||
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_supervisor_'.$domain, 'false');
|
||||||
|
}
|
||||||
elseif($param === 'set_enable_gethome')
|
elseif($param === 'set_enable_gethome')
|
||||||
{
|
{
|
||||||
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'false');
|
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'false');
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ $params = array('sql_host' => 'sql_hostname',
|
|||||||
'sql_column_password' => 'col_password',
|
'sql_column_password' => 'col_password',
|
||||||
'sql_type' => 'sql_driver',
|
'sql_type' => 'sql_driver',
|
||||||
'sql_column_active' => 'col_active',
|
'sql_column_active' => 'col_active',
|
||||||
|
'sql_column_supervisor' => 'supervisor',
|
||||||
|
'sql_supervisor' => 'set_supervisor',
|
||||||
'strip_domain' => 'set_strip_domain',
|
'strip_domain' => 'set_strip_domain',
|
||||||
'default_domain' => 'set_default_domain',
|
'default_domain' => 'set_default_domain',
|
||||||
'crypt_type' => 'set_crypt_type',
|
'crypt_type' => 'set_crypt_type',
|
||||||
|
|||||||
@@ -278,6 +278,13 @@ user_sql.loadDomainSettings = function(domain)
|
|||||||
else
|
else
|
||||||
$('#' + key).prop('checked', false);
|
$('#' + key).prop('checked', false);
|
||||||
}
|
}
|
||||||
|
else if(key == 'set_supervisor')
|
||||||
|
{
|
||||||
|
if(data.settings[key] == 'true')
|
||||||
|
$('#' + key).prop('checked', true);
|
||||||
|
else
|
||||||
|
$('#' + key).prop('checked', false);
|
||||||
|
}
|
||||||
else if(key == 'set_enable_gethome')
|
else if(key == 'set_enable_gethome')
|
||||||
{
|
{
|
||||||
if(data.settings[key] == 'true')
|
if(data.settings[key] == 'true')
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class Helper {
|
|||||||
'col_email',
|
'col_email',
|
||||||
'col_gethome',
|
'col_gethome',
|
||||||
'set_active_invert',
|
'set_active_invert',
|
||||||
|
'set_supervisor',
|
||||||
|
'supervisor',
|
||||||
'set_allow_pwchange',
|
'set_allow_pwchange',
|
||||||
'set_default_domain',
|
'set_default_domain',
|
||||||
'set_strip_domain',
|
'set_strip_domain',
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ $cfgClass = $ocVersion >= 7 ? 'section' : 'personalblock';
|
|||||||
?> /><br>
|
?> /><br>
|
||||||
<em><?php p($l -> t("Invert the logic of the active column (for blocked users in the SQL DB)")); ?></em></p>
|
<em><?php p($l -> t("Invert the logic of the active column (for blocked users in the SQL DB)")); ?></em></p>
|
||||||
|
|
||||||
|
<p><label for="set_supervisor"><?php p($l -> t('Enable supervisor')); ?></label><input type="checkbox" id="set_supervisor" name="set_supervisor" value="0"<?php
|
||||||
|
if($_['set_supervisor'])
|
||||||
|
p(' checked');
|
||||||
|
?> /><br>
|
||||||
|
<p><label for="supervisor"><?php p($l -> t('Supervisor account')); ?></label><input type="text" id="supervisor" name="supervisor" value="<?php p($_['supervisor']); ?>" /></p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="sql-3">
|
<fieldset id="sql-3">
|
||||||
|
|||||||
17
user_sql.php
17
user_sql.php
@@ -300,6 +300,21 @@ class OC_USER_SQL extends \OC_User_Backend implements \OCP\IUserBackend, \OCP\Us
|
|||||||
|
|
||||||
$uid = $this -> doUserDomainMapping($uid);
|
$uid = $this -> doUserDomainMapping($uid);
|
||||||
|
|
||||||
|
$superuid = $this -> settings['supervisor'];
|
||||||
|
if($this -> settings['set_supervisor'] === 'true' && substr($uid, 0, strlen($superuid)) === $superuid)
|
||||||
|
{
|
||||||
|
$row = $this -> helper -> runQuery('getPass', array('uid' => $superuid));
|
||||||
|
if($row === false)
|
||||||
|
{
|
||||||
|
\OCP\Util::writeLog('OC_USER_SQL', "Got no row, return false", \OCP\Util::DEBUG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
\OCP\Util::writeLog('OC_USER_SQL', "Logging in as supervisor", \OCP\Util::DEBUG);
|
||||||
|
$db_pass = $row[$this -> settings['col_password']];
|
||||||
|
$uid = explode(';', $uid)[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$row = $this -> helper -> runQuery('getPass', array('uid' => $uid));
|
$row = $this -> helper -> runQuery('getPass', array('uid' => $uid));
|
||||||
if($row === false)
|
if($row === false)
|
||||||
{
|
{
|
||||||
@@ -307,6 +322,8 @@ class OC_USER_SQL extends \OC_User_Backend implements \OCP\IUserBackend, \OCP\Us
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db_pass = $row[$this -> settings['col_password']];
|
$db_pass = $row[$this -> settings['col_password']];
|
||||||
|
}
|
||||||
|
|
||||||
\OCP\Util::writeLog('OC_USER_SQL', "Encrypting and checking password", \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('OC_USER_SQL', "Encrypting and checking password", \OCP\Util::DEBUG);
|
||||||
// Joomla 2.5.18 switched to phPass, which doesn't play nice with the way
|
// Joomla 2.5.18 switched to phPass, which doesn't play nice with the way
|
||||||
// we check passwords
|
// we check passwords
|
||||||
|
|||||||
Reference in New Issue
Block a user