* [bug#55228,done,0.8h] Can view attachments with preview permission only.

This commit is contained in:
hufangzhou
2024-09-19 14:44:08 +08:00
committed by 王于听
parent d60a418420
commit fd0aab86f1
3 changed files with 6 additions and 3 deletions
+2
View File
@@ -1 +1,3 @@
ALTER TABLE `zt_auditresult` ADD `severity` char(30) NOT NULL DEFAULT '' AFTER `comment`;
REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) SELECT `group`, 'file', 'download' FROM `zt_grouppriv` WHERE `module` = 'file' AND `method` = 'preview';
+3 -2
View File
@@ -1104,7 +1104,7 @@ class fileModel extends model
*/
public function printFile(object $file, string $method, bool $showDelete, bool $showEdit, object|null $object): string
{
if(!common::hasPriv('file', 'download')) return '';
if(!common::hasPriv('file', 'download') && !common::hasPriv('file', 'preview')) return '';
$html = '';
@@ -1123,10 +1123,11 @@ class fileModel extends model
$downloadLink = helper::createLink('file', 'download', "fileID=$file->id");
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
$downloadLink .= $sessionString;
$fileTitleLink = common::hasPriv('file', 'download') ? html::a($downloadLink, $fileTitle . " <span class='text-gray'>({$fileSize})</span>", '_blank', "id='fileTitle$file->id'") : "<div id='fileTitle$file->id' style='display: inline-block'>" . $fileTitle . " <span class='text-gray'>({$fileSize})</span></div>";
$objectType = zget($this->config->file->objectType, $file->objectType);
$html .= "<li class='mb-2 file' title='{$uploadDate}'>" . html::a($downloadLink, $fileTitle . " <span class='text-gray'>({$fileSize})</span>", '_blank', "id='fileTitle$file->id'");
$html .= "<li class='mb-2 file' title='{$uploadDate}'>" . $fileTitleLink;
if(strpos('view,edit', $method) !== false)
{
if(common::hasPriv($objectType, 'view', $object)) $html = $this->buildFileActions($html, $downloadLink, $imageWidth, $showEdit, $showDelete, $file, $object);
+1 -1
View File
@@ -2940,7 +2940,7 @@ $config->group->package->file->privs['file-edit'] = array('edition' => '
$config->group->package->file->privs['file-delete'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd,lite,or', 'order' => 2, 'depend' => array(), 'recommend' => array('file-edit'));
$config->group->package->file->privs['file-uploadImages'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd,lite,or', 'order' => 3, 'depend' => array(), 'recommend' => array());
$config->group->package->file->privs['file-setPublic'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd,lite,or', 'order' => 25, 'depend' => array(), 'recommend' => array());
$config->group->package->file->privs['file-preview'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd,lite,or', 'order' => 26, 'depend' => array(), 'recommend' => array());
$config->group->package->file->privs['file-preview'] = array('edition' => 'open,biz,max,ipd', 'vision' => 'rnd,lite,or', 'order' => 26, 'depend' => array('file-download'), 'recommend' => array());
$config->group->package->commonEffort = new stdclass();
$config->group->package->commonEffort->order = 5;