From 78a02478981891b98a2cbaa15e4bad83dd1c1324 Mon Sep 17 00:00:00 2001
From: Horst Knorr
Date: Tue, 30 Jan 2018 19:42:37 +0100
Subject: [PATCH] code for supervisor mode removed, because functionality
exists in official nextcloud app "impersonate" with better GUI
---
README.md | 7 -------
ajax/settings.php | 8 --------
appinfo/update.php | 2 --
js/settings.js | 7 -------
lib/helper.php | 2 --
lib/user_sql.php | 16 ----------------
templates/admin.php | 13 +------------
7 files changed, 1 insertion(+), 54 deletions(-)
diff --git a/README.md b/README.md
index 34621be..1ec67ec 100644
--- a/README.md
+++ b/README.md
@@ -57,11 +57,6 @@ Password changing is disabled by default, but can be enabled in the Admin area.
Caution: user_sql does not recreate password salts, which imposes a security risk.
Password salts should be newly generated whenever the password changes.
-Supervision can be enabled under supervisor settings. Supervision allows one
-specified user to login into any account. Use supervisor username and target
-username separated by ';' to login as target user using supervisor's password
-(ex. superuser;user).
-
The column autocomplete works only for MySQL and PostgreSQL database which is used to validate form data.
If you use other database use *occ* command to set the application config parameters with domain suffix.
@@ -84,8 +79,6 @@ For example to set 'sql_hostname' parameter in default domain use:
- col_email
- col_gethome
- set_active_invert
-- set_supervisor
-- supervisor
- set_allow_pwchange
- set_default_domain
- set_strip_domain
diff --git a/ajax/settings.php b/ajax/settings.php
index cdbf2eb..77de46f 100644
--- a/ajax/settings.php
+++ b/ajax/settings.php
@@ -134,10 +134,6 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
{
\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')
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'true');
@@ -160,10 +156,6 @@ if(isset($_POST['appname']) && ($_POST['appname'] === 'user_sql') && isset($_POS
{
\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')
{
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'false');
diff --git a/appinfo/update.php b/appinfo/update.php
index c5ae8a2..6312a16 100644
--- a/appinfo/update.php
+++ b/appinfo/update.php
@@ -32,8 +32,6 @@ $params = array('sql_host' => 'sql_hostname',
'sql_column_password' => 'col_password',
'sql_type' => 'sql_driver',
'sql_column_active' => 'col_active',
- 'sql_column_supervisor' => 'supervisor',
- 'sql_supervisor' => 'set_supervisor',
'strip_domain' => 'set_strip_domain',
'default_domain' => 'set_default_domain',
'crypt_type' => 'set_crypt_type',
diff --git a/js/settings.js b/js/settings.js
index 7455299..f9f6b44 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -322,13 +322,6 @@ user_sql.loadDomainSettings = function(domain)
else
$('#' + 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')
{
if(data.settings[key] == 'true')
diff --git a/lib/helper.php b/lib/helper.php
index 6375e26..0c0f782 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -59,8 +59,6 @@ class Helper {
'col_email',
'col_gethome',
'set_active_invert',
- 'set_supervisor',
- 'supervisor',
'set_allow_pwchange',
'set_default_domain',
'set_strip_domain',
diff --git a/lib/user_sql.php b/lib/user_sql.php
index 41a819e..eba5d38 100644
--- a/lib/user_sql.php
+++ b/lib/user_sql.php
@@ -389,21 +389,6 @@ class OC_USER_SQL extends BackendUtility implements \OCP\IUserBackend,
$uid = $this -> doUserDomainMapping($uid);
- $superuid = $this -> settings['supervisor'];
- if($uid !== $superuid && $this -> settings['set_supervisor'] === 'true' && substr($uid, 0, strlen($superuid)) === $superuid)
- {
- $row = $this -> helper -> runQuery('getPass', array('uid' => $superuid));
- if($row === false)
- {
- Util::writeLog('OC_USER_SQL', "Got no row, return false", Util::DEBUG);
- return false;
- }
- Util::writeLog('OC_USER_SQL', "Logging in as supervisor", Util::DEBUG);
- $db_pass = $row[$this -> settings['col_password']];
- $uid = explode(';', $uid)[1];
- }
- else
- {
$row = $this -> helper -> runQuery('getPass', array('uid' => $uid));
if($row === false)
{
@@ -411,7 +396,6 @@ class OC_USER_SQL extends BackendUtility implements \OCP\IUserBackend,
return false;
}
$db_pass = $row[$this -> settings['col_password']];
- }
Util::writeLog('OC_USER_SQL', "Encrypting and checking password",
Util::DEBUG);
diff --git a/templates/admin.php b/templates/admin.php
index 8cd6e05..d7f7048 100644
--- a/templates/admin.php
+++ b/templates/admin.php
@@ -22,8 +22,7 @@ $cfgClass = 'section';
t('E-Mail Settings')); ?>
t('Domain Settings')); ?>
t('getHome Settings')); ?>
- t('Supervisor Settings')); ?>
- t('Groups Settings')); ?>
+ t('Groups Settings')); ?>
-
-
-