Bug #76215
closedDataHandler | bypassAccessCheckForRecords flag gets lost
100%
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
Updated by Susanne Moog almost 7 years ago
- Category set to DataHandler aka TCEmain
Updated by Gerrit Code Review almost 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62931
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62972
Updated by Benni Mack almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8b5bc662cce22cd09d929e9e72cbd9ac4ac215fe.