Skip to content

Commit 78a0247

Browse files
code for supervisor mode removed, because functionality exists in official nextcloud app "impersonate" with better GUI
1 parent cf98f74 commit 78a0247

File tree

7 files changed

+1
-54
lines changed

7 files changed

+1
-54
lines changed

README.md

-7
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ Password changing is disabled by default, but can be enabled in the Admin area.
5757
Caution: user_sql does not recreate password salts, which imposes a security risk.
5858
Password salts should be newly generated whenever the password changes.
5959

60-
Supervision can be enabled under supervisor settings. Supervision allows one
61-
specified user to login into any account. Use supervisor username and target
62-
username separated by ';' to login as target user using supervisor's password
63-
(ex. superuser;user).
64-
6560
The column autocomplete works only for MySQL and PostgreSQL database which is used to validate form data.
6661
If you use other database use *occ* command to set the application config parameters with domain suffix.
6762

@@ -84,8 +79,6 @@ For example to set 'sql_hostname' parameter in default domain use:
8479
- col_email
8580
- col_gethome
8681
- set_active_invert
87-
- set_supervisor
88-
- supervisor
8982
- set_allow_pwchange
9083
- set_default_domain
9184
- set_strip_domain

ajax/settings.php

-8
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@
134134
{
135135
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'true');
136136
}
137-
elseif($param === 'set_supervisor')
138-
{
139-
\OC::$server->getConfig()->setAppValue('user_sql', 'set_supervisor_'.$domain, 'true');
140-
}
141137
elseif($param === 'set_enable_gethome')
142138
{
143139
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'true');
@@ -160,10 +156,6 @@
160156
{
161157
\OC::$server->getConfig()->setAppValue('user_sql', 'set_active_invert_'.$domain, 'false');
162158
}
163-
elseif($param === 'set_supervisor')
164-
{
165-
\OC::$server->getConfig()->setAppValue('user_sql', 'set_supervisor_'.$domain, 'false');
166-
}
167159
elseif($param === 'set_enable_gethome')
168160
{
169161
\OC::$server->getConfig()->setAppValue('user_sql', 'set_enable_gethome_'.$domain, 'false');

appinfo/update.php

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
'sql_column_password' => 'col_password',
3333
'sql_type' => 'sql_driver',
3434
'sql_column_active' => 'col_active',
35-
'sql_column_supervisor' => 'supervisor',
36-
'sql_supervisor' => 'set_supervisor',
3735
'strip_domain' => 'set_strip_domain',
3836
'default_domain' => 'set_default_domain',
3937
'crypt_type' => 'set_crypt_type',

js/settings.js

-7
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,6 @@ user_sql.loadDomainSettings = function(domain)
322322
else
323323
$('#' + key).prop('checked', false);
324324
}
325-
else if(key == 'set_supervisor')
326-
{
327-
if(data.settings[key] == 'true')
328-
$('#' + key).prop('checked', true);
329-
else
330-
$('#' + key).prop('checked', false);
331-
}
332325
else if(key == 'set_enable_gethome')
333326
{
334327
if(data.settings[key] == 'true')

lib/helper.php

-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ public function getParameterArray()
5959
'col_email',
6060
'col_gethome',
6161
'set_active_invert',
62-
'set_supervisor',
63-
'supervisor',
6462
'set_allow_pwchange',
6563
'set_default_domain',
6664
'set_strip_domain',

lib/user_sql.php

-16
Original file line numberDiff line numberDiff line change
@@ -389,29 +389,13 @@ public function checkPassword($uid, $password)
389389

390390
$uid = $this -> doUserDomainMapping($uid);
391391

392-
$superuid = $this -> settings['supervisor'];
393-
if($uid !== $superuid && $this -> settings['set_supervisor'] === 'true' && substr($uid, 0, strlen($superuid)) === $superuid)
394-
{
395-
$row = $this -> helper -> runQuery('getPass', array('uid' => $superuid));
396-
if($row === false)
397-
{
398-
Util::writeLog('OC_USER_SQL', "Got no row, return false", Util::DEBUG);
399-
return false;
400-
}
401-
Util::writeLog('OC_USER_SQL', "Logging in as supervisor", Util::DEBUG);
402-
$db_pass = $row[$this -> settings['col_password']];
403-
$uid = explode(';', $uid)[1];
404-
}
405-
else
406-
{
407392
$row = $this -> helper -> runQuery('getPass', array('uid' => $uid));
408393
if($row === false)
409394
{
410395
Util::writeLog('OC_USER_SQL', "Got no row, return false", Util::DEBUG);
411396
return false;
412397
}
413398
$db_pass = $row[$this -> settings['col_password']];
414-
}
415399

416400
Util::writeLog('OC_USER_SQL', "Encrypting and checking password",
417401
Util::DEBUG);

templates/admin.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
<li><a id="sqlEmailSettings" href="#sql-3"><?php p($l -> t('E-Mail Settings')); ?></a></li>
2323
<li><a id="sqlDomainSettings" href="#sql-4"><?php p($l -> t('Domain Settings')); ?></a></li>
2424
<li><a id="sqlGethomeSettings" href="#sql-5"><?php p($l -> t('getHome Settings')); ?></a></li>
25-
<li><a id="sqlSupervisorSettings" href="#sql-6"><?php p($l -> t('Supervisor Settings')); ?></a></li>
26-
<li><a id="sqlGroupsSettings" href="#sql-7"><?php p($l -> t('Groups Settings')); ?></a></li>
25+
<li><a id="sqlGroupsSettings" href="#sql-6"><?php p($l -> t('Groups Settings')); ?></a></li>
2726
</ul>
2827

2928
<fieldset id="sql-1">
@@ -160,17 +159,7 @@
160159
<em><?php p($l -> t('You can use the placeholders %%u to specify the user ID (before appending the default domain), %%ud to specify the user ID (after appending the default domain) and %%d to specify the default domain')); ?></em></p>
161160

162161
</fieldset>
163-
164162
<fieldset id="sql-6">
165-
<p><label for="set_supervisor"><?php p($l -> t('Enable supervisor')); ?></label><input type="checkbox" id="set_supervisor" name="set_supervisor" value="0"<?php
166-
if($_['set_supervisor'])
167-
p(' checked');
168-
?> /><br>
169-
<p><label for="supervisor"><?php p($l -> t('Supervisor username')); ?></label><input type="text" id="supervisor" name="supervisor" value="<?php p($_['supervisor']); ?>" /></p>
170-
<em><?php p($l -> t("Use supervisor username and target username separated by ';' to login as target user using supervisor's password (ex. superuser;user).")); ?></em></p>
171-
</fieldset>
172-
173-
<fieldset id="sql-7">
174163
<p><label for="sql_group_table"><?php p($l -> t('Table')); ?></label><input type="text" id="sql_group_table" name="sql_group_table" value="<?php p($_['sql_group_table']); ?>" /></p>
175164

176165
<p><label for="col_group_username"><?php p($l -> t('Username Column')); ?></label><input type="text" id="col_group_username" name="col_group_username" value="<?php p($_['col_group_username']); ?>" /></p>

0 commit comments

Comments
 (0)