#110242DataHandler::hasPageContextPermission() denies admin / bypassAccessCheckForRecords when BE user uid is 0
Description
Summary
Since 14.3.5 / 13.4.33, DataHandler::hasPageContextPermission() returns false for a backend user with uid = 0, even when that user is an admin or when bypassAccessCheckForRecords is enabled. The !$beUserUid guard was moved in front of both escape hatches, so neither is reached for a uid-0 user. This worked in 14.3.4.
Behavior change
In Classes/DataHandling/DataHandler.php, hasPageContextPermission():
$beUserUid = $this->BE_USER->getUserId();
if (!$beUserUid) {
return false; // uid 0 returns here
}
if ($this->bypassAccessCheckForRecords || $this->BE_USER->isAdmin()) {
return true; // never reached for uid 0
}
The !$beUserUid guard now precedes the bypassAccessCheckForRecords / isAdmin() check. In 14.3.4 that path reached the bypass regardless of uid. Since bypassAccessCheckForRecords exists for exactly the user-less case, a falsy-uid guard defeating it looks like an ordering oversight, not intended tightening.
Impact
hasPageContextPermission() is the first sub-check inside hasPermissionToInsert(). When it returns false, the insert is rejected and logged as:
Attempt to insert record on pages:{pid} where table "{table}" is not allowed
The message is misleading: isTableAllowedForThisPage() is unchanged and passes — the real failure is the page-permission check short-circuiting on uid 0. The symptom points at TCA / rootLevel config while the cause is the guard ordering.
Steps to reproduce
- Build a
BackendUserAuthenticationwithuser = ['uid' => 0, 'admin' => 1](or set$dataHandler->bypassAccessCheckForRecords = true). - Run
DataHandler::start()with a datamap inserting a record on a normal page. - On 14.3.4 the insert succeeds; on 14.3.5 / 13.4.33 it is rejected.
Suggested change
Move the bypassAccessCheckForRecords / isAdmin() escape hatch before the !$beUserUid guard, so admin and explicit-bypass contexts are honoured independent of uid:
if ($this->bypassAccessCheckForRecords || $this->BE_USER->isAdmin()) {
return true;
}
$beUserUid = $this->BE_USER->getUserId();
if (!$beUserUid) {
return false;
}
This restores the 14.3.4 behaviour while keeping the refined root-level handling intact.
Secondary consideration: the
VirtualRecord::RootPage/shallIgnoreRootLevelRestriction()branch also sits after the!$beUserUidguard and may need to move above it too — worth confirming during review.
Notes
Reported at github.com/maikschneider/tca-api/issues/157; Oliver Hader confirmed reordering so bypassAccessCheckForRecords runs first is acceptable.
Reviews 3
Related issues 1
History 69
-
Oliver Hader changed Related to #107432 <span data-processor="relativetime" data-value="2026-07-21T07:29:58+00:00" > 07/21/26, 07:29 </span>
-
Oliver Hader changed status
NewAccepted <span data-processor="relativetime" data-value="2026-07-21T09:16:17+00:00" > 07/21/26, 09:16 </span> -
Gerrit Code Review pushed patch set 1 for main to change 94880 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2026-07-22T11:00:16+00:00" > 07/22/26, 11:00 </span> -
Oliver Hader changed Duplicated by #110380 <span data-processor="relativetime" data-value="2026-08-07T14:24:28+00:00" > 08/07/26, 14:24 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 95165 <span data-processor="relativetime" data-value="2026-08-07T14:26:07+00:00" > 08/07/26, 14:26 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 95166 <span data-processor="relativetime" data-value="2026-08-07T14:28:10+00:00" > 08/07/26, 14:28 </span>
-
Oliver Hader commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-08-07T18:50:11+00:00" > 08/07/26, 18:50 </span>Applied in changeset commit:ee251c96d55b6e609a77334324be0b91bb0839e5.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:51:52+00:00" > 08/11/26, 08:51 </span>
IMHO the change is correct.
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DataHandler/Introduction/Index.html states
> DataHandler requires a backend login to work. This is due to the fact that permissions are observed (of course) and thus DataHandler needs a backend user to evaluate against.
So as you already set a config like admin=1, I suggest to also set a correct uid