Project

General

Profile

Actions

Bug #76215

closed

DataHandler | bypassAccessCheckForRecords flag gets lost

Added by Andreas Stenger over 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2016-05-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

The following code inside a backend-module fails due to access restrictions.

private function clonePages($copyPid, $targetPid)
{
    $cmdmap['pages'][$copyPid]['copy'] = $targetPid;

    $this->tce->copyTree = 99;

    $this->tce->bypassAccessCheckForRecords = true;
    $this->tce->start(false, $cmdmap);
    $this->tce->process_cmdmap();

    return $this->tce->copyMappingArray_merged;
}

Goal:
Copy the page-tree of $copyPid recursive as new child-tree of $targetPid.

Issue:
The current backend-user does not have access (no db-mount) to the page $copyPid nor to the page $targetPid.
By setting $this->tce->bypassAccessCheckForRecords = true; however the access-check for $copyPid gets skipped, as intended.
For the access-check of $targetPid the flag is false for some reason what results in "Attempt to insert a record on page '###' (###) from table 'pages' without permissions. Or non-existing page."
I dont see a way to keep the flag set to true allthough in this case i need both checks to be skipped.

This can be checked by e.g. var_dumping $this->bypassAccessCheckForRecords in TYPO3\CMS\Core\DataHandling\DataHandler::doesRecordExist

Actions

Also available in: Atom PDF