[BUGFIX] Show Create Content button only for allowed languages 47/49847/2
authorDaniel Maier <dani-maier@gmx.de>
Fri, 2 Sep 2016 21:08:03 +0000 (23:08 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 21 Oct 2016 08:37:10 +0000 (10:37 +0200)
The Create Content button inside the Page Module is now only shown for
languages the backend-user is actually allowed to edit. That way, users
that are restricted to a specific language and not allowed to edit the
default language, do not see this button inside the default language column
any more. (Note: this patch only hides the button itself, the later processing
was already prevented before.)

Resolves: #77753
Releases: master, 7.6
Change-Id: I44ebacaf1d1d0635b0af1e7e52689f077f6fa2b4
Reviewed-on: https://review.typo3.org/49847
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Daniel Maier <dani-maier@gmx.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/View/PageLayoutView.php

index eb2f7f0..b1aecc8 100644 (file)
@@ -574,14 +574,16 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                         . ' '
                         . $this->getLanguageService()->getLL('content', true) . '</a>';
                 }
-                $content[$key] .= '
-                               <div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility::getUniqueId() . '">
-                                       <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'
-                        . $link
-                    . '</div>
-                    <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
-                </div>
-                               ';
+                if ($this->getBackendUser()->checkLanguageAccess($lP)) {
+                    $content[$key] .= '
+                    <div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility::getUniqueId() . '">
+                        <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'
+                            . $link
+                            . '</div>
+                        <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
+                    </div>
+                    ';
+                }
                 $editUidList = '';
                 if (!isset($contentRecordsPerColumn[$key]) || !is_array($contentRecordsPerColumn[$key])) {
                     $message = GeneralUtility::makeInstance(
@@ -648,6 +650,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                             // Add icon "new content element below"
                             if (!$disableMoveAndNewButtons
                                 && $this->getPageLayoutController()->contentIsNotLockedForEditors()
+                                && $this->getBackendUser()->checkLanguageAccess($lP)
                                 && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
                             ) {
                                 // New content element: