Skip to content

Commit

Permalink
Merge pull request #21 from gpgmailencrypt/master
Browse files Browse the repository at this point in the history
code for supervisor mode removed
  • Loading branch information
mlojewski-me authored Jan 31, 2018
2 parents bac7236 + 78a0247 commit 9e539de
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 54 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down
8 changes: 0 additions & 8 deletions ajax/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@
{
\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');
Expand All @@ -160,10 +156,6 @@
{
\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');
Expand Down
2 changes: 0 additions & 2 deletions appinfo/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
'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',
Expand Down
7 changes: 0 additions & 7 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions lib/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public function getParameterArray()
'col_email',
'col_gethome',
'set_active_invert',
'set_supervisor',
'supervisor',
'set_allow_pwchange',
'set_default_domain',
'set_strip_domain',
Expand Down
16 changes: 0 additions & 16 deletions lib/user_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,29 +389,13 @@ public function checkPassword($uid, $password)

$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)
{
Util::writeLog('OC_USER_SQL', "Got no row, return false", Util::DEBUG);
return false;
}
$db_pass = $row[$this -> settings['col_password']];
}

Util::writeLog('OC_USER_SQL', "Encrypting and checking password",
Util::DEBUG);
Expand Down
13 changes: 1 addition & 12 deletions templates/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
<li><a id="sqlEmailSettings" href="#sql-3"><?php p($l -> t('E-Mail Settings')); ?></a></li>
<li><a id="sqlDomainSettings" href="#sql-4"><?php p($l -> t('Domain Settings')); ?></a></li>
<li><a id="sqlGethomeSettings" href="#sql-5"><?php p($l -> t('getHome Settings')); ?></a></li>
<li><a id="sqlSupervisorSettings" href="#sql-6"><?php p($l -> t('Supervisor Settings')); ?></a></li>
<li><a id="sqlGroupsSettings" href="#sql-7"><?php p($l -> t('Groups Settings')); ?></a></li>
<li><a id="sqlGroupsSettings" href="#sql-6"><?php p($l -> t('Groups Settings')); ?></a></li>
</ul>

<fieldset id="sql-1">
Expand Down Expand Up @@ -160,17 +159,7 @@
<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>

</fieldset>

<fieldset id="sql-6">
<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 username')); ?></label><input type="text" id="supervisor" name="supervisor" value="<?php p($_['supervisor']); ?>" /></p>
<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>
</fieldset>

<fieldset id="sql-7">
<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>

<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>
Expand Down

0 comments on commit 9e539de

Please sign in to comment.