Skip to content

Commit

Permalink
[BUGFIX] Respect language permissions for page translations in list
Browse files Browse the repository at this point in the history
module

If an editor has got access to only a subset of languages, only those
must be visible within the list module for page translations.

Resolves: #90367
Releases: master, 9.5
Change-Id: I6deae42f2428e23d0dfb7656905db7c453119000
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63232
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Richard Haeser <richard@maxserv.com>
  • Loading branch information
georgringer authored and Richard Haeser committed Feb 14, 2020
1 parent 2af570a commit 8362e5d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ function editRecords(table,idList,addParams,CBflag) {
$pageTranslationsDatabaseRecordList->deniedNewTables = ['pages'];
$pageTranslationsDatabaseRecordList->hideTranslations = '';
$pageTranslationsDatabaseRecordList->iLimit = $pageTranslationsDatabaseRecordList->itemsLimitPerTable;
$pageTranslationsDatabaseRecordList->setLanguagesAllowedForUser($this->siteLanguages);
$pageTranslationsDatabaseRecordList->showOnlyTranslatedRecords(true);
$output .= $pageTranslationsDatabaseRecordList->getTable('pages', $this->id);
}
Expand Down
22 changes: 22 additions & 0 deletions typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ class DatabaseRecordList
*/
protected $systemLanguagesOnPage;

/**
* All languages that are allowed by the user
*
* @var array
*/
protected $languagesAllowedForUser = [];

/**
* Constructor
*/
Expand Down Expand Up @@ -901,6 +908,11 @@ public function getTable($table, $id, $rowList = '')
}
$hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
}

if ($table == 'pages' && $this->showOnlyTranslatedRecords) {
$addWhere .= ' AND ' . $GLOBALS['TCA']['pages']['ctrl']['languageField'] . ' IN(' . implode(',', array_keys($this->languagesAllowedForUser)) . ')';
}

$additionalConstraints = empty($addWhere) ? [] : [QueryHelper::stripLogicalOperatorPrefix($addWhere)];
$selFieldList = GeneralUtility::trimExplode(',', $selFieldList, true);

Expand Down Expand Up @@ -4086,4 +4098,14 @@ protected function getLanguageService()
{
return $GLOBALS['LANG'];
}

/**
* @param array $languagesAllowedForUser
* @return DatabaseRecordList
*/
public function setLanguagesAllowedForUser(array $languagesAllowedForUser): DatabaseRecordList
{
$this->languagesAllowedForUser = $languagesAllowedForUser;
return $this;
}
}

0 comments on commit 8362e5d

Please sign in to comment.