Issue Bug Under Review Quiet

#110506TCA ignoreWebMountRestriction is not respected in BackendModule

Tim Horstmann 08/20/26, 12:35 updated 09/27/26, 13:40

Description

When using the Viewhelper be:uri.editRecord in a backend module to jump into edit form of a record, the TCA option ignoreWebMountRestriction is not evaluated. Records outside the Webmount can not be edited.

*My Setup is*
- TYPO3 14.3.6
- PHP 8.4.22
- DB Driver pdo_pgsql (should not be relevant, just mention this as it is not standard in my setup)

*Reproduce*
- Custom record which is stored on the startpage (root of pagetree, uid 1 in my case)
- TCA with ctrl->security->ignoreWebMountRestriction set
- TCA has ctrl->rootLevel = 0, just to make sure the record is not saved on root
- a backend module with an edit button which points to a record (or new record) as described in Documentation https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/ApiOverview/Backend/UriBuilder.html
- login with a backend user who is no admin and does not have the startpage mounted in his pagetree, but has access granted to backend module and custom record

*Error*
When clicking the edit button, the edit form is not loaded. Instead 2 error messages appear.

Sorry, you didn't have proper permissions to perform this change.
No content edit permission for user 9 on page 1
Edit form could not be loaded
The edit form could not be loaded for the requested records. This might be due to insufficient permissions.

The error is thrown in TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUserPermissionCheck

// A non page record is edited.
// If there is a parent page row, check content edit right of user
$userPermissionOnPage = new Permission($backendUser->calcPerms($result['parentPageRow']));
if (!$userPermissionOnPage->editContentPermissionIsGranted()) {
  $exception = new AccessDeniedContentEditException(
    'No content edit permission for user ' . $backendUser->user['uid'] . ' on page ' . $result['parentPageRow']['uid'],
    1437679657
  );
}

but actually comes from TYPO3\CMS\Core\Authentication\BackendUserAuthentication->calcPerms. There is a check for webMount

        // Return 0 if page is not within the allowed web mount
        if (!$this->isInWebMount($row, '', $useDeleteClause)) {
            return Permission::NOTHING;
        }

but this uses pid of the record and the actual webmounts and does not check ignoreWebMountRestriction.
My expectation would be, that the editForm is displayed.

When clicking the edit button as an admin, everything works as exspected. The edit form is shown and changes can be saved.

*Solution*
IMHO there should be a check with TcaSchemaCapability::RestrictionWebMount, but unfortunately there is no information about the current table available, so a fix has a bigger scope. As calcPerms is used quite often in the core, I feel not very confident to fix this by myself.

I created a workaround posted as comment.

Reviews 1

History 23

  1. Tim Horstmann commented <span data-processor="relativetime" data-value="2026-08-20T12:39:28+00:00" > 08/20/26, 12:39 </span>

    I used an EventListener as temporary workaround:

    use TYPO3\CMS\Backend\Form\Event\ModifyEditFormUserAccessEvent;
    use TYPO3\CMS\Core\Attribute\AsEventListener;
    
    #[AsEventListener(
        identifier: 'mms-api/edit-records-outside-webmount',
    )]
    final readonly class EditRecordsOutsideWebMountListener
    {
        public function __invoke(ModifyEditFormUserAccessEvent $event): void
        {
            $tablesOutsideWebMount = [
                'tx_mmsapi_domain_model_appmaintenance',
                'tx_mmsapi_domain_model_appupdate',
            ];
            if (in_array($event->getTableName(), $tablesOutsideWebMount, true)) {
                $event->allowUserAccess();
            }
        }
    }

    With this Fix, the editForm is displayed. Unfortunately the form could not be saved which seems to be targeted in https://forge.typo3.org/issues/109199.
    With the suggested solution to overwrite TCA and set ignoreWebMountRestriction for pages, my custom record could be saved by a non-admin.