From bb366c550ecd3d43c24419a311846f328153eace Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Wed, 17 Aug 2022 08:28:55 +0200 Subject: [PATCH] [TASK] Allow hiding "Entire workspace" drop down Workspace backend module: With #94935 the "Entire workspace" mass drop down has been placed more prominently by moving it to the first position in the action drop down row. The "Entire workspace" action publishes *all* pending workspace changes of *all* pages at once. Depending on use case, this can be dangerous: There are cases where a workspace is used to prepare a small amount of changes, to then publish everything at once. This is fine. There are also use cases where editors use one big workspace to prepare distinct changes in multiple pages and then publish single pages only. In the latter case, accidently using the "Publish absolutely everything" drop down will publish lots of unwanted changes. To mitigate this risk, admins get a new toggle in the workspace 'publish_access' field of workspace records to hide the "Entire workspace" action drop down of this workspace when checked. Resolves: #98155 Related: #94935 Related: #96468 Releases: main, 11.5 Change-Id: Ia55bf509df17842ad1f6c5fdea031fb633419f08 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75478 Tested-by: core-ci <typo3@b13.com> Tested-by: Claus-Peter Eberwein <claus-peter.eberwein@b13.com> Tested-by: Benni Mack <benni@typo3.org> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Claus-Peter Eberwein <claus-peter.eberwein@b13.com> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../workspaces/Classes/Controller/ReviewController.php | 1 + .../workspaces/Configuration/TCA/sys_workspace.php | 1 + .../Resources/Private/Language/locallang_db.xlf | 3 +++ .../Resources/Private/Partials/WorkingTable.html | 10 +++++----- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php index 77f267d69f53..06d674eea5a3 100644 --- a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php +++ b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php @@ -122,6 +122,7 @@ class ReviewController 'availableStages' => $this->stagesService->getStagesForWSUser(), 'availableSelectStages' => $this->getAvailableSelectStages(), 'stageActions' => $this->getStageActions(), + 'showEntireWorkspaceDropDown' => !(($backendUser->workspaceRec['publish_access'] ?? 0) & 4), 'selectedLanguage' => $selectedLanguage, 'selectedDepth' => (int)$moduleData->get('depth', ($pageUid === 0 ? 999 : 1)), 'selectedStage' => (int)$moduleData->get('stage'), diff --git a/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php b/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php index 16ad3c6b09f6..a3da1470d328 100644 --- a/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php +++ b/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php @@ -107,6 +107,7 @@ return [ 'items' => [ ['LLL:EXT:workspaces/Resources/Private/Language/locallang_db.xlf:sys_workspace.publish_access.1'], ['LLL:EXT:workspaces/Resources/Private/Language/locallang_db.xlf:sys_workspace.publish_access.2'], + ['LLL:EXT:workspaces/Resources/Private/Language/locallang_db.xlf:sys_workspace.publish_access.3'], ], ], ], diff --git a/typo3/sysext/workspaces/Resources/Private/Language/locallang_db.xlf b/typo3/sysext/workspaces/Resources/Private/Language/locallang_db.xlf index ebdb94112d4b..aea6a0329766 100644 --- a/typo3/sysext/workspaces/Resources/Private/Language/locallang_db.xlf +++ b/typo3/sysext/workspaces/Resources/Private/Language/locallang_db.xlf @@ -105,6 +105,9 @@ <trans-unit id="sys_workspace.publish_access.2" resname="sys_workspace.publish_access.2"> <source>Restrict publishing to workspace owners</source> </trans-unit> + <trans-unit id="sys_workspace.publish_access.3" resname="sys_workspace.publish_access.3"> + <source>Hide "Entire workspace" action drop down</source> + </trans-unit> <trans-unit id="sys_workspace.stagechg_notification" resname="sys_workspace.stagechg_notification"> <source>Notification settings during state change</source> </trans-unit> diff --git a/typo3/sysext/workspaces/Resources/Private/Partials/WorkingTable.html b/typo3/sysext/workspaces/Resources/Private/Partials/WorkingTable.html index 0f955ec8ff1d..d9430a647851 100644 --- a/typo3/sysext/workspaces/Resources/Private/Partials/WorkingTable.html +++ b/typo3/sysext/workspaces/Resources/Private/Partials/WorkingTable.html @@ -46,7 +46,7 @@ </div> </div> </form> - <f:render section="multiRecordSelectionActions" arguments="{stageActions: stageActions, availableStages: availableStages, position: 'top'}" /> + <f:render section="multiRecordSelectionActions" arguments="{stageActions: stageActions, availableStages: availableStages, showEntireWorkspaceDropDown: showEntireWorkspaceDropDown, position: 'top'}" /> <div id="workspace-content-wrapper"> <div id="workspace-contents" class="table-fit mb-0" style="display: none"> <table class="table table-striped"> @@ -94,16 +94,16 @@ </div> </div> </div> - <f:render section="multiRecordSelectionActions" arguments="{stageActions: stageActions, availableStages: availableStages, position: 'bottom'}" /> + <f:render section="multiRecordSelectionActions" arguments="{stageActions: stageActions, availableStages: availableStages, showEntireWorkspaceDropDown: showEntireWorkspaceDropDown, position: 'bottom'}" /> <nav id="workspace-pagination" class="mt-3"></nav> </div> </html> <f:section name="multiRecordSelectionActions"> <div class="row workspace-actions multi-record-selection-actions-wrapper gx-0 hidden"> - <f:if condition="{stageActions}"> + <f:if condition="{stageActions} && {showEntireWorkspaceDropDown}"> <div class="col-auto"> - <div class="row row-cols-auto align-items-center g-2"> + <div class="row row-cols-auto align-items-center g-2 me-2"> <label class="col" for="mass-action-{position}"> <strong><f:translate key="LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:entireWorkspace" /></strong> </label> @@ -119,7 +119,7 @@ </div> </f:if> <div class="col-auto"> - <div class="row row-cols-auto align-items-center g-2 mx-2 t3js-multi-record-selection-actions hidden"> + <div class="row row-cols-auto align-items-center g-2 t3js-multi-record-selection-actions hidden"> <div class="col"> <strong><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.selection"/></strong> </div> -- GitLab