Commit 4a584abd authored by Benni Mack's avatar Benni Mack Committed by Oliver Hader
Browse files

[TASK] Remove obsolete state for group resolving in BE_USER

The internal public property BE_USER->dataLists is removed
as all data is now directly written into groupData now.

This is part of a larger clean up of legacy code of
UserAuthentication.

Resolves: #93052
Releases: master
Change-Id: I92ce48e71c5463ff5ddd3971deb5a82931dcc908
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67089

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
parent f75c9472
......@@ -121,7 +121,7 @@ class UserInformationService
}
// languages
$languages = GeneralUtility::trimExplode(',', $user->dataLists['allowed_languages'], true);
$languages = GeneralUtility::trimExplode(',', $user->groupData['allowed_languages'], true);
asort($languages);
foreach ($languages as $language) {
$record = BackendUtility::getRecord('sys_language', (int)$language);
......@@ -134,7 +134,7 @@ class UserInformationService
$data['tables']['tables_select'] = [];
$data['tables']['tables_modify'] = [];
foreach (['tables_select', 'tables_modify'] as $tableField) {
$temp = GeneralUtility::trimExplode(',', $user->dataLists[$tableField], true);
$temp = GeneralUtility::trimExplode(',', $user->groupData[$tableField], true);
foreach ($temp as $tableName) {
$data['tables'][$tableField][$tableName] = $GLOBALS['TCA'][$tableName]['ctrl']['title'];
}
......@@ -142,7 +142,7 @@ class UserInformationService
$data['tables']['all'] = array_replace($data['tables']['tables_select'] ?? [], $data['tables']['tables_modify'] ?? []);
// DB mounts
$dbMounts = GeneralUtility::trimExplode(',', $user->dataLists['webmount_list'], true);
$dbMounts = GeneralUtility::trimExplode(',', $user->groupData['webmounts'], true);
asort($dbMounts);
foreach ($dbMounts as $mount) {
$record = BackendUtility::getRecord('pages', (int)$mount);
......@@ -152,7 +152,7 @@ class UserInformationService
}
// File mounts
$fileMounts = GeneralUtility::trimExplode(',', $user->dataLists['filemount_list'], true);
$fileMounts = GeneralUtility::trimExplode(',', $user->groupData['filemounts'], true);
asort($fileMounts);
foreach ($fileMounts as $mount) {
$record = BackendUtility::getRecord('sys_filemounts', (int)$mount);
......@@ -162,7 +162,7 @@ class UserInformationService
}
// Modules
$modules = GeneralUtility::trimExplode(',', $user->dataLists['modList'], true);
$modules = GeneralUtility::trimExplode(',', $user->groupData['modules'], true);
foreach ($modules as $module) {
$data['modules'][$module] = $GLOBALS['TBE_MODULES']['_configuration'][$module];
}
......@@ -186,7 +186,7 @@ class UserInformationService
}
// file & folder permissions
if ($filePermissions = $user->dataLists['file_permissions']) {
if ($filePermissions = $user->groupData['file_permissions']) {
$items = GeneralUtility::trimExplode(',', $filePermissions, true);
foreach ($GLOBALS['TCA']['be_groups']['columns']['file_permissions']['config']['items'] as $availableItem) {
if (in_array($availableItem[1], $items, true)) {
......@@ -199,7 +199,7 @@ class UserInformationService
$data['tsconfig'] = $user->getTSConfig();
// non_exclude_fields
$fieldListTmp = GeneralUtility::trimExplode(',', $user->dataLists['non_exclude_fields'], true);
$fieldListTmp = GeneralUtility::trimExplode(',', $user->groupData['non_exclude_fields'], true);
$fieldList = [];
foreach ($fieldListTmp as $item) {
$split = explode(':', $item);
......@@ -216,7 +216,7 @@ class UserInformationService
$specialItems = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
foreach ($specialItems as $specialItem) {
$value = $specialItem[1];
if (!GeneralUtility::inList($user->dataLists['pagetypes_select'], $value)) {
if (!GeneralUtility::inList($user->groupData['pagetypes_select'], $value)) {
continue;
}
$label = $specialItem[0];
......
......@@ -115,29 +115,6 @@ class BackendUserAuthentication extends AbstractUserAuthentication
*/
public $workspaceRec = [];
/**
* Used to accumulate data for the user-group.
* DON NOT USE THIS EXTERNALLY!
* Use $this->groupData instead
* @var array
* @internal
*/
public $dataLists = [
'webmount_list' => '',
'filemount_list' => '',
'file_permissions' => '',
'modList' => '',
'tables_select' => '',
'tables_modify' => '',
'pagetypes_select' => '',
'non_exclude_fields' => '',
'explicit_allowdeny' => '',
'allowed_languages' => '',
'workspace_perms' => '',
'available_widgets' => '',
'custom_options' => ''
];
/**
* List of group_id's in the order they are processed.
* @var array
......@@ -1261,19 +1238,19 @@ class BackendUserAuthentication extends AbstractUserAuthentication
if ($this->user['uid']) {
// Get lists for the be_user record and set them as default/primary values.
// Enabled Backend Modules
$this->dataLists['modList'] = $this->user['userMods'];
$this->groupData['modules'] = $this->user['userMods'];
// Add available widgets
$this->dataLists['available_widgets'] = $this->user['available_widgets'];
$this->groupData['available_widgets'] = $this->user['available_widgets'];
// Add Allowed Languages
$this->dataLists['allowed_languages'] = $this->user['allowed_languages'];
$this->groupData['allowed_languages'] = $this->user['allowed_languages'];
// Set user value for workspace permissions.
$this->dataLists['workspace_perms'] = $this->user['workspace_perms'];
$this->groupData['workspace_perms'] = $this->user['workspace_perms'];
// Database mountpoints
$this->dataLists['webmount_list'] = $this->user['db_mountpoints'];
$this->groupData['webmounts'] = $this->user['db_mountpoints'];
// File mountpoints
$this->dataLists['filemount_list'] = $this->user['file_mountpoints'];
$this->groupData['filemounts'] = $this->user['file_mountpoints'];
// Fileoperation permissions
$this->dataLists['file_permissions'] = $this->user['file_permissions'];
$this->groupData['file_permissions'] = $this->user['file_permissions'];
// BE_GROUPS:
// Get the groups...
......@@ -1295,21 +1272,20 @@ class BackendUserAuthentication extends AbstractUserAuthentication
// Processing webmounts
// Admin's always have the root mounted
if ($this->isAdmin() && !($this->getTSConfig()['options.']['dontMountAdminMounts'] ?? false)) {
$this->dataLists['webmount_list'] = '0,' . $this->dataLists['webmount_list'];
$this->groupData['webmounts'] = '0,' . $this->groupData['webmounts'];
}
// The lists are cleaned for duplicates
$this->groupData['webmounts'] = StringUtility::uniqueList($this->dataLists['webmount_list'] ?? '');
$this->groupData['pagetypes_select'] = StringUtility::uniqueList($this->dataLists['pagetypes_select'] ?? '');
$this->groupData['tables_select'] = StringUtility::uniqueList(($this->dataLists['tables_modify'] ?? '') . ',' . ($this->dataLists['tables_select'] ?? ''));
$this->groupData['tables_modify'] = StringUtility::uniqueList($this->dataLists['tables_modify'] ?? '');
$this->groupData['non_exclude_fields'] = StringUtility::uniqueList($this->dataLists['non_exclude_fields'] ?? '');
$this->groupData['explicit_allowdeny'] = StringUtility::uniqueList($this->dataLists['explicit_allowdeny'] ?? '');
$this->groupData['allowed_languages'] = StringUtility::uniqueList($this->dataLists['allowed_languages'] ?? '');
$this->groupData['custom_options'] = StringUtility::uniqueList($this->dataLists['custom_options'] ?? '');
$this->groupData['modules'] = StringUtility::uniqueList($this->dataLists['modList'] ?? '');
$this->groupData['available_widgets'] = StringUtility::uniqueList($this->dataLists['available_widgets'] ?? '');
$this->groupData['file_permissions'] = StringUtility::uniqueList($this->dataLists['file_permissions'] ?? '');
$this->groupData['workspace_perms'] = $this->dataLists['workspace_perms'];
$this->groupData['webmounts'] = StringUtility::uniqueList($this->groupData['webmounts'] ?? '');
$this->groupData['pagetypes_select'] = StringUtility::uniqueList($this->groupData['pagetypes_select'] ?? '');
$this->groupData['tables_select'] = StringUtility::uniqueList(($this->groupData['tables_modify'] ?? '') . ',' . ($this->groupData['tables_select'] ?? ''));
$this->groupData['tables_modify'] = StringUtility::uniqueList($this->groupData['tables_modify'] ?? '');
$this->groupData['non_exclude_fields'] = StringUtility::uniqueList($this->groupData['non_exclude_fields'] ?? '');
$this->groupData['explicit_allowdeny'] = StringUtility::uniqueList($this->groupData['explicit_allowdeny'] ?? '');
$this->groupData['allowed_languages'] = StringUtility::uniqueList($this->groupData['allowed_languages'] ?? '');
$this->groupData['custom_options'] = StringUtility::uniqueList($this->groupData['custom_options'] ?? '');
$this->groupData['modules'] = StringUtility::uniqueList($this->groupData['modules'] ?? '');
$this->groupData['available_widgets'] = StringUtility::uniqueList($this->groupData['available_widgets'] ?? '');
$this->groupData['file_permissions'] = StringUtility::uniqueList($this->groupData['file_permissions'] ?? '');
// Check if the user access to all web mounts set
if (!empty(trim($this->groupData['webmounts']))) {
......@@ -1466,25 +1442,25 @@ TCAdefaults.sys_note.email = ' . $this->user['email'];
$this->includeGroupArray[] = $uid;
// Mount group database-mounts
if ($mountOptions->shouldUserIncludePageMountsFromAssociatedGroups()) {
$this->dataLists['webmount_list'] .= ',' . $row['db_mountpoints'];
$this->groupData['webmounts'] .= ',' . $row['db_mountpoints'];
}
// Mount group file-mounts
if ($mountOptions->shouldUserIncludeFileMountsFromAssociatedGroups()) {
$this->dataLists['filemount_list'] .= ',' . $row['file_mountpoints'];
$this->groupData['filemounts'] .= ',' . $row['file_mountpoints'];
}
// The lists are made: groupMods, tables_select, tables_modify, pagetypes_select, non_exclude_fields, explicit_allowdeny, allowed_languages, custom_options
$this->dataLists['modList'] .= ',' . $row['groupMods'];
$this->dataLists['available_widgets'] .= ',' . $row['availableWidgets'];
$this->dataLists['tables_select'] .= ',' . $row['tables_select'];
$this->dataLists['tables_modify'] .= ',' . $row['tables_modify'];
$this->dataLists['pagetypes_select'] .= ',' . $row['pagetypes_select'];
$this->dataLists['non_exclude_fields'] .= ',' . $row['non_exclude_fields'];
$this->dataLists['explicit_allowdeny'] .= ',' . $row['explicit_allowdeny'];
$this->dataLists['allowed_languages'] .= ',' . $row['allowed_languages'];
$this->dataLists['custom_options'] .= ',' . $row['custom_options'];
$this->dataLists['file_permissions'] .= ',' . $row['file_permissions'];
$this->groupData['modules'] .= ',' . $row['groupMods'];
$this->groupData['available_widgets'] .= ',' . $row['availableWidgets'];
$this->groupData['tables_select'] .= ',' . $row['tables_select'];
$this->groupData['tables_modify'] .= ',' . $row['tables_modify'];
$this->groupData['pagetypes_select'] .= ',' . $row['pagetypes_select'];
$this->groupData['non_exclude_fields'] .= ',' . $row['non_exclude_fields'];
$this->groupData['explicit_allowdeny'] .= ',' . $row['explicit_allowdeny'];
$this->groupData['allowed_languages'] .= ',' . $row['allowed_languages'];
$this->groupData['custom_options'] .= ',' . $row['custom_options'];
$this->groupData['file_permissions'] .= ',' . $row['file_permissions'];
// Setting workspace permissions:
$this->dataLists['workspace_perms'] |= $row['workspace_perms'];
$this->groupData['workspace_perms'] |= $row['workspace_perms'];
// If this function is processing the users OWN group-list (not subgroups) AND
// if the ->firstMainGroup is not set, then the ->firstMainGroup will be set.
if ($idList === '' && !$this->firstMainGroup) {
......@@ -1603,7 +1579,7 @@ TCAdefaults.sys_note.email = ' . $this->user['email'];
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
// Processing file mounts (both from the user and the groups)
$fileMounts = array_unique(GeneralUtility::intExplode(',', $this->dataLists['filemount_list'], true));
$fileMounts = array_unique(GeneralUtility::intExplode(',', $this->groupData['filemounts'], true));
// Limit file mounts if set in workspace record
if ($this->workspace > 0 && !empty($this->workspaceRec['file_mountpoints'])) {
......@@ -2016,7 +1992,7 @@ TCAdefaults.sys_note.email = ' . $this->user['email'];
// but make sure they match against the users' DB mounts
$workspaceWebMounts = GeneralUtility::intExplode(',', $dbMountpoints);
$webMountsOfUser = GeneralUtility::intExplode(',', $this->dataLists['webmount_list']);
$webMountsOfUser = GeneralUtility::intExplode(',', $this->groupData['webmounts']);
$webMountsOfUser = array_combine($webMountsOfUser, $webMountsOfUser);
$entryPointRootLineUids = [];
......
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