diff --git a/typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php b/typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php index 23b82c97cbb6..e988fb2a8828 100644 --- a/typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php +++ b/typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php @@ -222,7 +222,7 @@ protected function canCreateNew(): bool */ protected function canBeCopied(): bool { - return $this->record->checkActionPermission('read') && !$this->isRecordInClipboard('copy'); + return $this->record->checkActionPermission('read') && $this->record->checkActionPermission('copy') && !$this->isRecordInClipboard('copy'); } /** @@ -278,6 +278,9 @@ protected function isFoldersAreInTheSameRoot($fileOrFolderInClipBoard): bool */ protected function isRecordInClipboard(string $mode = ''): bool { + if ($mode !== '' && !$this->record->checkActionPermission($mode)) { + return false; + } $isSelected = ''; // Pseudo table name for use in the clipboard. $table = '_FILE'; diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php index 787e95465f5f..4c1607edbef9 100644 --- a/typo3/sysext/filelist/Classes/FileList.php +++ b/typo3/sysext/filelist/Classes/FileList.php @@ -477,7 +477,9 @@ public function getTable($rowlist) $table = '_FILE'; $elFromTable = $this->clipObj->elFromTable($table); if (!empty($elFromTable) && $this->folderObject->checkActionPermission('write')) { - $addPasteButton = true; + $clipboardMode = $this->clipObj->clipData[$this->clipObj->current]['mode'] ?? ''; + $permission = $clipboardMode === 'copy' ? 'copy' : 'move'; + $addPasteButton = $this->folderObject->checkActionPermission($permission); $elToConfirm = []; foreach ($elFromTable as $key => $element) { $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element); @@ -504,11 +506,17 @@ public function getTable($rowlist) . $this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL) ->render() . ''; + } else { + $cells[] = $this->spaceIcon; } } if ($this->clipObj->current !== 'normal' && $iOut) { - $cells[] = $this->linkClipboardHeaderIcon('' . $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render() . '', $table, 'setCB'); - $cells[] = $this->linkClipboardHeaderIcon('' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render(), $table, 'delete', $this->getLanguageService()->getLL('clip_deleteMarkedWarning')); + if ($this->folderObject->checkActionPermission('copy') && $this->folderObject->checkActionPermission('write') && $this->folderObject->checkActionPermission('move')) { + $cells[] = $this->linkClipboardHeaderIcon('' . $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render() . '', $table, 'setCB'); + } + if ($this->folderObject->checkActionPermission('delete')) { + $cells[] = $this->linkClipboardHeaderIcon('' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render(), $table, 'delete', $this->getLanguageService()->getLL('clip_deleteMarkedWarning')); + } $onClick = 'checkOffCB(' . GeneralUtility::quoteJSvalue(implode(',', $this->CBnames)) . ', this); return false;'; $cells[] = '' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . ''; } @@ -1259,11 +1267,15 @@ public function makeClip($fileOrFolderObject) $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL)->render(); } - $cells[] = '' . $copyIcon . ''; + if ($fileOrFolderObject->checkActionPermission('copy')) { + $cells[] = '' . $copyIcon . ''; + } else { + $cells[] = $this->spaceIcon; + } // we can only cut if file can be moved if ($fileOrFolderObject->checkActionPermission('move')) { $cells[] = '