configuring a user id in the settings uses a list of existing users

This commit is contained in:
Uwe Steinmann 2020-08-19 13:21:51 +02:00
parent eb4d97c8a5
commit 1726d1f1f2
3 changed files with 34 additions and 4 deletions

View File

@ -8,6 +8,7 @@
- add hooks showDocumentKeywords and showDocumentCategories
- sort versions of extension in extension manager propperly
- fix output of help text for config vars in extension
- configuring a user id in the settings uses a list of existing users
--------------------------------------------------------------------------------
Changes in version 5.1.18

View File

@ -151,7 +151,7 @@ if ($action == "saveSettings")
$settings->_loginFailure = intval($_POST["loginFailure"]);
$settings->_autoLoginUser = intval($_POST["autoLoginUser"]);
$settings->_quota = intval($_POST["quota"]);
$settings->_undelUserIds = strval($_POST["undelUserIds"]);
$settings->_undelUserIds = is_array($_POST["undelUserIds"]) ? implode(',', $_POST["undelUserIds"]) : strval($_POST["undelUserIds"]);
$settings->_encryptionKey = strval($_POST["encryptionKey"]);
$settings->_cookieLifetime = intval($_POST["cookieLifetime"]);
$settings->_defaultAccessDocs = intval($_POST["defaultAccessDocs"]);

View File

@ -175,6 +175,34 @@ class SeedDMS_View_Settings extends SeedDMS_Bootstrap_Style {
<?php
} /* }}} */
protected function showConfigUser($title, $name, $allowempty=false, $multiple=false, $size=0) { /* {{{ */
$settings = $this->params['settings'];
$dms = $this->params['dms'];
?>
<tr title="<?= getMLText($title."_desc") ?>">
<td><?= getMLText($title) ?>:</td>
<td>
<?php
$users = $dms->getAllUsers();
if($users) {
$selections = explode(',', $settings->{"_".$name});
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$name.($multiple ? "[]" : "")."\"".($multiple ? " multiple" : "").($size ? " size=\"".$size."\"" : "")." data-placeholder=\"".getMLText("select_user")."\">";
if($allowempty)
echo "<option value=\"\"></option>";
foreach($users as $curuser) {
echo "<option value=\"".$curuser->getID()."\"";
if(in_array($curuser->getID(), $selections))
echo " selected";
echo ">".htmlspecialchars($curuser->getLogin()." - ".$curuser->getFullName())."</option>";
}
echo "</select>";
}
?>
</td>
</tr>
<?php
} /* }}} */
function js() { /* {{{ */
$extmgr = $this->params['extmgr'];
@ -374,7 +402,7 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
<?php $this->showConfigText('settings_loginFailure', 'loginFailure'); ?>
<?php $this->showConfigText('settings_autoLoginUser', 'autoLoginUser'); ?>
<?php $this->showConfigText('settings_quota', 'quota'); ?>
<?php $this->showConfigText('settings_undelUserIds', 'undelUserIds'); ?>
<?php $this->showConfigUser('settings_undelUserIds', 'undelUserIds', true, true); ?>
<?php $this->showConfigText('settings_encryptionKey', 'encryptionKey'); ?>
<?php $this->showConfigText('settings_cookieLifetime', 'cookieLifetime'); ?>
<?php $this->showConfigOption('settings_defaultAccessDocs', 'defaultAccessDocs', array(' 0'=>'inherited', ' '.M_NONE=>'access_mode_none', ' '.M_READ=>'access_mode_read', ' '.M_READWRITE=>'access_mode_readwrite'), false, true); ?>
@ -419,10 +447,11 @@ $this->showStartPaneContent('site', (!$currenttab || $currenttab == 'site'));
-- SETTINGS - ADVANCED - AUTHENTICATION
-->
<?php $this->showConfigHeadline('settings_Authentication'); ?>
<?php $this->showConfigText('settings_guestID', 'guestID'); ?>
<?php $this->showConfigUser('settings_guestID', 'guestID', true); ?>
<?php $this->showConfigText('settings_adminIP', 'adminIP'); ?>
<?php $this->showConfigText('settings_apiKey', 'apiKey'); ?>
<?php $this->showConfigText('settings_apiUserId', 'apiUserId'); ?>
<?php //$this->showConfigText('settings_apiUserId', 'apiUserId'); ?>
<?php $this->showConfigUser('settings_apiUserId', 'apiUserId', true); ?>
<?php $this->showConfigText('settings_apiOrigin', 'apiOrigin'); ?>
<!--