Bug #85824

Trying to delete page with subpages with translations as admin gives error: "Attempt to delete page without permissions"

Added by Sybille Peters almost 2 years ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2018-08-13
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Associated revisions

Revision 02e81aeb (diff)
Added by Sybille Peters 2 months ago

[BUGFIX] Fix order of deleting page translations in DataHandler

If a page translation exists, it should be deleted before the
original page.

It the translation is deleted after the deletion of the original
page, this will result in an error because the existance and
delete permissions of the original page is checked before
deletion of the translated page.

Resolves: #85824
Releases: master, 9.5
Change-Id: I74b333fd450ea4bf361efbcd39a4daa07002c930
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63757
Tested-by: TYPO3com <>
Tested-by: Georg Ringer <>
Tested-by: Benni Mack <>
Reviewed-by: Georg Ringer <>
Reviewed-by: Benni Mack <>

Revision 0c1c3d56 (diff)
Added by Sybille Peters 2 months ago

[BUGFIX] Fix order of deleting page translations in DataHandler

If a page translation exists, it should be deleted before the
original page.

It the translation is deleted after the deletion of the original
page, this will result in an error because the existence and
delete permissions of the original page is checked before
deletion of the translated page.

Resolves: #85824
Releases: master, 9.5
Change-Id: I74b333fd450ea4bf361efbcd39a4daa07002c930
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63871
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Stephan GroƟberndt almost 2 years ago

  • Status changed from New to Needs Feedback

Did you go to "User settings" -> "Edit and Advanced functions" and enabled the checkbox at "Recursive Delete(!): Allow ALL subpages to be deleted when deleting a page"? In TYPO3 7.6 and 8.7 this definitely is not a general problem (you chose 7 as TYPO3 version for this bug)..

#2 Updated by Sybille Peters almost 2 years ago

  • Status changed from Needs Feedback to Closed

@Stephan Yes, I did, but as I have been unable to reproduce this now, I will close.

#3 Updated by Sybille Peters 3 months ago

  • Subject changed from Trying to delete pages with subpages as admin gives error: "Attempt to delete page without permissions" to Trying to delete page with subpages with translations as admin gives error: "Attempt to delete page without permissions"
  • Status changed from Closed to New
  • TYPO3 Version changed from 7 to 9

I still get this problem and I can reproduce it now: It happens when trying to delete pages with translations pages.

Tested with current 9.5.

Problem occurs if deletion is performed in Backend as system user.

I get the error message: "Attempt to delete page without permissions" 

I have set the recursive delete option so that is not the problem.

  • delete page without translation: no error
  • delete page with translation (and no subpages): no error
  • delete page without translation + subpage without translation: no error
  • delete page with subpage with translation: ERROR

#4 Updated by Sybille Peters 3 months ago

I can also reproduce this with latest master (10.4-dev)

#5 Updated by Sybille Peters 3 months ago

The problem seems to be in the order deletion of pages with translations is performed in DataHandler::deleteRecord()

GeneralUtility::makeInstance(ConnectionPool::class)
    ->getConnectionForTable($table)
    ->delete($table, ['uid' => (int)$uid]);
$this->deletedRecords[$table][] = (int)$uid;
$this->deleteL10nOverlayRecords($table, $uid);

which results in the original page already being deleted when canDeletePage is called:

DataHandler::canDeletePage($uid)
{
        $uid = (int)$uid;
        $isTranslatedPage = null;

        // If we may at all delete this page
        // If this is a page translation, do the check against the perms_* of the default page
        // Because it is currently only deleting the translation
        $defaultLanguagePageId = $this->getDefaultLanguagePageId($uid);
        if ($defaultLanguagePageId !== $uid) {
            if ($this->doesRecordExist('pages', (int)$defaultLanguagePageId, 'delete')) {
                $isTranslatedPage = true;
            } else {
                return 'Attempt to delete page without permissions';
            }

The problem happens when this function is called for the translated page. In that case, the original page was already deleted (deleted=1) and the function doesRecordExist() will fail.

#6 Updated by Gerrit Code Review 3 months 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/+/63757

#7 Updated by Gerrit Code Review 2 months ago

Patch set 2 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/+/63757

#8 Updated by Gerrit Code Review 2 months ago

Patch set 3 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/+/63757

#9 Updated by Gerrit Code Review 2 months ago

Patch set 4 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/+/63757

#10 Updated by Gerrit Code Review 2 months ago

Patch set 5 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/+/63757

#11 Updated by Gerrit Code Review 2 months ago

Patch set 6 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/+/63757

#12 Updated by Sybille Peters 2 months ago

  • Category changed from Backend API to DataHandler aka TCEmain

#13 Updated by Gerrit Code Review 2 months 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/+/63871

#14 Updated by Sybille Peters 2 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#15 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF