add upload folder

This commit is contained in:
Uwe Steinmann 2023-01-09 10:05:22 +01:00
parent 2ed11ce519
commit d91bae4692
2 changed files with 17 additions and 5 deletions

View File

@ -828,11 +828,17 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
$fulltextservice = $this->container->fulltextservice;
$notifier = $this->container->notifier;
if(!empty($settings->_extensions['paperless']['usehomefolder'])) {
if(!($mfolder = $dms->getFolder((int) $userobj->getHomeFolder())))
if(isset($settings->_extensions['paperless']['uploadfolder']))
$mfolder = $dms->getFolder($settings->_extensions['paperless']['uploadfolder']);
if(!$mfolder) {
if(!empty($settings->_extensions['paperless']['usehomefolder'])) {
if(!($mfolder = $dms->getFolder((int) $userobj->getHomeFolder())))
$mfolder = $dms->getFolder($settings->_rootFolderID);
} elseif(!isset($settings->_extensions['paperless']['rootfolder']) || !($mfolder = $dms->getFolder($settings->_extensions['paperless']['rootfolder'])))
$mfolder = $dms->getFolder($settings->_rootFolderID);
} elseif(!isset($settings->_extensions['paperless']['rootfolder']) || !($mfolder = $dms->getFolder($settings->_extensions['paperless']['rootfolder'])))
$mfolder = $dms->getFolder($settings->_rootFolderID);
}
if($mfolder) {
if($mfolder->getAccessMode($userobj) < M_READWRITE)
return $response->withStatus(403);

View File

@ -9,7 +9,7 @@ $EXT_CONF['paperless'] = array(
'config' => array(
'rootfolder' => array(
'title'=>'Folder used as root folder',
'help'=>'This is the folder used as the base folder. Uploaded documents will be saved in this folder and all documents listed will result in fulltext search below this folder.',
'help'=>'This is the folder used as the base folder. Documens not below this folder will be not shown by the papeerless mobile app. Uploaded documents will be saved into this folder, unless the dedicated upload folder is set.',
'type'=>'select',
'internal'=>'folders',
),
@ -18,6 +18,12 @@ $EXT_CONF['paperless'] = array(
'type'=>'checkbox',
'help'=>"Enable, if the user's home folder shall be used instead of the configured root folder.",
),
'uploadfolder' => array(
'title'=>'Folder where new documents are uploaded',
'help'=>'This is the folder where new documents will be uploaded by the paperless mobile app.',
'type'=>'select',
'internal'=>'folders',
),
'jwtsecret' => array(
'title'=>'Secret for JSON Web Token',
'help'=>'This is used for creating a token which is needed to authenticate by token',