Commit 67846838 authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Fix undefined array key warnings

When comparing user groups, a fake user record
is created to fetch the group data for. This led to
a couple of undefined array key warnings, which
are now fixed.

Resolves: #96038
Releases: master, 11.5
Change-Id: Ia1ed0dcf4483bf5b8bef26992c8943284c32de29
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72238


Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent 0a9898e1
......@@ -63,6 +63,10 @@ class UserInformationService
'uid' => PHP_INT_MAX,
'options' => 3,
'workspace_id' => -99,
'realName' => 'fakeUser',
'email' => 'fake.user@typo3.org',
'TSconfig' => '',
'category_perms' => '',
$user->usergroup_column => $groupId,
];
$user->fetchGroupData();
......@@ -169,7 +173,7 @@ class UserInformationService
// Modules
$modules = GeneralUtility::trimExplode(',', $user->groupData['modules'], true);
foreach ($modules as $module) {
$data['modules'][$module] = $GLOBALS['TBE_MODULES']['_configuration'][$module];
$data['modules'][$module] = $GLOBALS['TBE_MODULES']['_configuration'][$module] ?? '';
}
$data['modules'] = array_filter($data['modules']);
......
......@@ -270,7 +270,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
*/
public function isAdmin()
{
return is_array($this->user) && ($this->user['admin'] & 1) == 1;
return is_array($this->user) && (($this->user['admin'] ?? 0) & 1) == 1;
}
/**
......@@ -1121,7 +1121,7 @@ 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->groupData['modules'] = $this->user['userMods'];
$this->groupData['modules'] = $this->user['userMods'] ?? '';
// Add available widgets
$this->groupData['available_widgets'] = $this->user['available_widgets'] ?? '';
// Add allowed mfa providers
......@@ -1129,13 +1129,13 @@ class BackendUserAuthentication extends AbstractUserAuthentication
// Add Allowed Languages
$this->groupData['allowed_languages'] = $this->user['allowed_languages'] ?? '';
// Set user value for workspace permissions.
$this->groupData['workspace_perms'] = $this->user['workspace_perms'];
$this->groupData['workspace_perms'] = $this->user['workspace_perms'] ?? 0;
// Database mountpoints
$this->groupData['webmounts'] = $this->user['db_mountpoints'];
$this->groupData['webmounts'] = $this->user['db_mountpoints'] ?? '';
// File mountpoints
$this->groupData['filemounts'] = $this->user['file_mountpoints'];
$this->groupData['filemounts'] = $this->user['file_mountpoints'] ?? '';
// Fileoperation permissions
$this->groupData['file_permissions'] = $this->user['file_permissions'];
$this->groupData['file_permissions'] = $this->user['file_permissions'] ?? '';
// Get the groups and accumulate their permission settings
$mountOptions = new BackendGroupMountOption($this->user['options']);
......
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