Commit 538bb7cb authored by Gianluigi Martino's avatar Gianluigi Martino Committed by Benni Mack
Browse files

[BUGFIX] Respect language restrictions for direct page title editing

If the user has no access to edit the title of the page due to language
restrictions, the pencil next to the title in the page module is
no longer visible.

Resolves: #88337
Releases: master, 9.5
Change-Id: Ia41821dd82821ad2c8d5a60dd053a43cadb0c361
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60837

Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 39797983
......@@ -660,7 +660,7 @@ class PageLayoutController
if ($this->id && $access) {
// Initialize permission settings:
$this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);
$this->EDIT_CONTENT = $this->isContentEditable();
$this->EDIT_CONTENT = $this->isContentEditable($this->current_sys_language);
$this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
......@@ -708,7 +708,7 @@ class PageLayoutController
if ($this->MOD_SETTINGS['function'] == 1 || $this->MOD_SETTINGS['function'] == 2) {
$content .= '<form action="' . htmlspecialchars((string)$uriBuilder->buildUriFromRoute($this->moduleName, ['id' => $this->id, 'imagemode' => $this->imagemode])) . '" id="PageLayoutController" method="post">';
// Page title
$content .= '<h1 class="t3js-title-inlineedit">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>';
$content .= '<h1 class="' . ($this->isPageEditable($this->current_sys_language) ? 't3js-title-inlineedit' : '') . '">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>';
// All other listings
$content .= $this->renderContent();
}
......@@ -948,7 +948,7 @@ class PageLayoutController
}
if (empty($this->modTSconfig['properties']['disableIconToolbar'])) {
// Edit page properties and page language overlay icons
if ($this->isPageEditable() && $this->getBackendUser()->checkLanguageAccess(0)) {
if ($this->isPageEditable(0)) {
/** @var \TYPO3\CMS\Core\Http\NormalizedParams */
$normalizedParams = $request->getAttribute('normalizedParams');
// Edit localized pages only when one specific language is selected
......@@ -1124,47 +1124,35 @@ class PageLayoutController
/**
* Check if page can be edited by current user
*
* @param int|null $languageId
* @return bool
*/
protected function isPageEditable(): bool
protected function isPageEditable(int $languageId): bool
{
if ($this->getBackendUser()->isAdmin()) {
return true;
}
return !$this->pageinfo['editlock'] && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::PAGE_EDIT);
}
/**
* Check if page can be edited by current user
*
* @return bool
*/
protected function pageIsNotLockedForEditors(): bool
{
return $this->isPageEditable();
return !$this->pageinfo['editlock']
&& $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::PAGE_EDIT)
&& $this->getBackendUser()->checkLanguageAccess($languageId);
}
/**
* Check if content can be edited by current user
*
* @param int $languageId
* @return bool
*/
protected function isContentEditable(): bool
protected function isContentEditable(int $languageId): bool
{
if ($this->getBackendUser()->isAdmin()) {
return true;
}
return !$this->pageinfo['editlock'] && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT);
}
/**
* Check if content can be edited by current user
*
* @return bool
*/
protected function contentIsNotLockedForEditors(): bool
{
return $this->isContentEditable();
return !$this->pageinfo['editlock']
&& $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)
&& $this->getBackendUser()->checkLanguageAccess($languageId);
}
/**
......
......@@ -1511,7 +1511,7 @@ class PageLayoutView implements LoggerAwareInterface
// Get values:
$Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
// Attach edit icon
if ($this->doEdit && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
if ($this->doEdit) {
$urlParameters = [
'edit' => [
$table => [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment