Project

General

Profile

Actions

Bug #93097

closed

Faulty live view in comparison preview for non LIVE-Editors

Added by Uwe Trotzek over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2020-12-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In Version TYPO3 10.4.10 there is a problem in the comparison view for editors without LIVE-editing permissions. You can reproduce the error as follows:

  • Login as an editor without LIVE-editing permissions
  • Switch to a workspace
  • Edit an existing content element (e.g. Text) with some text
  • Open the preview of the page
  • Use the slider to compare the workspace version with de live version

Actual behaviour:
The live version displays changed element even thoug it hasn't been published yet. The view is correct when you open the comparison with an editor who has LIVE-editing permissions.

Expected behaviour:
The text change should only be visible in the draft version and not in the live view when using the slider.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #93371: TYPO3 10.4.x workspaces user without permission " Edit live (Online)" also dont see Live version in Preview. Bug?Closed2021-01-26

Actions
Related to TYPO3 Core - Bug #34199: Navigating through 'Live' preview will load 'Workspace' version in 'Live'Closed2012-02-23

Actions
Has duplicate TYPO3 Core - Bug #94829: Wrong workspace preview of published version if user has no access for live editingClosed2021-08-12

Actions
Actions #1

Updated by Oleg Karun about 3 years ago

Uwe Trotzek wrote:

In Version TYPO3 10.4.10 there is a problem in the comparison view for editors without LIVE-editing permissions. You can reproduce the error as follows:

  • Login as an editor without LIVE-editing permissions
  • Switch to a workspace
  • Edit an existing content element (e.g. Text) with some text
  • Open the preview of the page
  • Use the slider to compare the workspace version with de live version

Actual behaviour:
The live version displays changed element even thoug it hasn't been published yet. The view is correct when you open the comparison with an editor who has LIVE-editing permissions.

Expected behaviour:
The text change should only be visible in the draft version and not in the live view when using the slider.

Same for me TYPO3 10.4.12

Actions #2

Updated by Riccardo De Contardi about 3 years ago

  • Related to Bug #93371: TYPO3 10.4.x workspaces user without permission " Edit live (Online)" also dont see Live version in Preview. Bug? added
Actions #3

Updated by schmitz no-lastname-given about 3 years ago

Same in TYPO3 version 9.5.24.

Actions #4

Updated by Roman Stulz almost 3 years ago

Hi all

I actually have the same issue with v10.4.13

Are there an updates related to this bug?

Thank you!

Actions #5

Updated by Eric Harrer almost 3 years ago

Same in TYPO3 version v10.4.15

Actions #6

Updated by Carsten Kettner over 2 years ago

Same issue in version 10.4.16

Actions #7

Updated by Lidia Demin about 2 years ago

Can confirm this problem on TYPO3 10.4.22. Might this be related to #96077?

Actions #8

Updated by Eric Harrer over 1 year ago

Same issue in version 10.4.30

I've gotten a little more into that now.

The relevant part is in file EXT:workspaces/Classes/Middleware/WorkspacePreview.php on line 118 in function WorkspacePreview->process():

// If keyword is set to "LIVE", then ensure that there is no workspace preview, but keep the BE User logged in.
// This option is solely used to ensure that a be user can preview the live version of a page in the
// workspace preview module.
if ($keyword === 'LIVE' && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) {
    // We need to set the workspace to live here
    $GLOBALS['BE_USER']->setTemporaryWorkspace(0); /* < this includes a check for the current groups workspace_perms */
    // Register the backend user as aspect
    $this->setBackendUserAspect($context, $GLOBALS['BE_USER']);
    // Caching is disabled, because otherwise generated URLs could include the keyword parameter
    $request = $request->withAttribute('noCache', true);
    $addInformationAboutDisabledCache = true;
    $setCookieOnCurrentRequest = false;
}

If I put the line

$GLOBALS['BE_USER']->groupData['workspace_perms'] = 1;

before line

$GLOBALS['BE_USER']->setTemporaryWorkspace(0);

the problem is solved.

since at this point, regardless of the "workspace_perms" setting of the current backend user group, the live workspace should be displayed, I would say that this is a useful workaround. What do you think?

For the moment I have solved this by XCLASSing \TYPO3\CMS\Workspaces\Middleware\WorkspacePreview.
Enter the following in ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Workspaces\Middleware\WorkspacePreview::class] = [
    'className' => \VendorName\PackageName\Middleware\WorkspacePreview::class
];

and create the following class under EXT:package_name/Classes/Middleware/WorkspacePreview.php


<?php

namespace VendorName\PackageName\Middleware;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;

class WorkspacePreview extends \TYPO3\CMS\Workspaces\Middleware\WorkspacePreview
{
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $keyword = $this->getPreviewInputCode($request);
        if ($keyword === 'LIVE' && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) {
            $GLOBALS['BE_USER']->groupData['workspace_perms'] = 1;
        }
        return parent::process($request, $handler);
    }
}

Actions #9

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #10

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #11

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #12

Updated by Nikita Hovratov over 1 year ago

  • Has duplicate Bug #94829: Wrong workspace preview of published version if user has no access for live editing added
Actions #13

Updated by Nikita Hovratov over 1 year ago

  • Related to Bug #34199: Navigating through 'Live' preview will load 'Workspace' version in 'Live' added
Actions #14

Updated by Gerrit Code Review over 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #15

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.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/+/76272

Actions #16

Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #17

Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #18

Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74993

Actions #19

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch 11.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/+/76272

Actions #20

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch 11.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/+/76272

Actions #21

Updated by Eric Harrer over 1 year ago

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

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF