Skip to content

Commit

Permalink
[BUGFIX] Recycler does not show workspace records in live
Browse files Browse the repository at this point in the history
The patch fixes a couple of database restrictions to prevent
the recycler from showing workspace related records in live
workspace.
Note there are further issues with the recycler in workspace
context. Those need work on workspace record lifecycles first,
and are not tackled with the patch.

Resolves: #92056
Related: #21299
Releases: master, 10.4
Change-Id: Ib2d9a14231d01a861c731f4ce39b8f0cf5eddc73
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65414
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
lolli42 authored and ervaude committed Aug 21, 2020
1 parent 85ca2a0 commit 2af3338
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use TYPO3\CMS\Core\Database\Platform\PlatformInformation;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -163,7 +163,6 @@ protected function setData($id, $table, $depth, $filter)
if (!empty($this->limit)) {
// count the number of deleted records for this pid
$queryBuilder = $this->getFilteredQueryBuilder($table, $id, $depth, $filter);
$queryBuilder->getRestrictions()->removeAll();

$deletedCount = (int)$queryBuilder
->count('*')
Expand Down Expand Up @@ -264,9 +263,8 @@ protected function getFilteredQueryBuilder(string $table, int $pid, int $depth,
{
$pidList = $this->getTreeList($pid, $depth);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
$queryBuilder->getRestrictions()->removeAll()
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getBackendUser()->workspace));

// create the filter WHERE-clause
$filterConstraint = null;
Expand Down Expand Up @@ -437,7 +435,8 @@ public function undeleteData($recordsArray, $recursive = false)
protected function getDeletedParentPages($uid, &$pages = [])
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->getRestrictions()->removeAll()
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getBackendUser()->workspace));
$record = $queryBuilder
->select('uid', 'pid')
->from('pages')
Expand Down Expand Up @@ -533,7 +532,8 @@ protected function resolveTree(int $id, int $depth, int $begin = 0, string $perm
}
if ($depth > 0) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
$queryBuilder->getRestrictions()->removeAll()
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getBackendUser()->workspace));
$statement = $queryBuilder->select('uid')
->from('pages')
->where(
Expand Down

0 comments on commit 2af3338

Please sign in to comment.