[BUGFIX] Fix warnings on felogin / Use correct usergroup-column 00/28000/4
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 3 Mar 2014 19:04:43 +0000 (20:04 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Mon, 3 Mar 2014 20:13:30 +0000 (21:13 +0100)
PHP Warning: Illegal string offset 'usergroup' is shown when
trying to login to the frontend while currently already being
logged into the backend.

Also the usergroup-column needs to be fetched from
$this->fe_user->usergroup_column.

Change-Id: Ia9772262616e9bd62e0827b0f211b8efe77ea80b
Resolves: #56508
Releases: 6.2
Reviewed-on: https://review.typo3.org/28000
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 4be87dc..e8a356d 100644 (file)
@@ -1127,13 +1127,16 @@ class TypoScriptFrontendController {
                $this->setIDfromArgV();
                // If there is a Backend login we are going to check for any preview settings:
                $GLOBALS['TT']->push('beUserLogin', '');
+               $originalFrontendUser = NULL;
                if ($this->beUserLogin || $this->doWorkspacePreview()) {
                        // Backend user preview features:
                        if ($this->beUserLogin && $GLOBALS['BE_USER']->adminPanel instanceof \TYPO3\CMS\Frontend\View\AdminPanelView) {
                                $this->fePreview = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview') ? TRUE : FALSE;
                                // If admin panel preview is enabled...
                                if ($this->fePreview) {
-                                       $fe_user_OLD_USERGROUP = $this->fe_user->user['usergroup'];
+                                       if ($this->fe_user->user) {
+                                               $originalFrontendUser = $this->fe_user->user;
+                                       }
                                        $this->showHiddenPage = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenPages');
                                        $this->showHiddenRecords = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenRecords');
                                        // Simulate date
@@ -1146,7 +1149,13 @@ class TypoScriptFrontendController {
                                        $simUserGroup = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateUserGroup');
                                        $this->simUserGroup = $simUserGroup;
                                        if ($simUserGroup) {
-                                               $this->fe_user->user['usergroup'] = $simUserGroup;
+                                               if ($this->fe_user->user) {
+                                                       $this->fe_user->user[$this->fe_user->usergroup_column] = $simUserGroup;
+                                               } else {
+                                                       $this->fe_user->user = array(
+                                                               $this->fe_user->usergroup_column => $simUserGroup
+                                                       );
+                                               }
                                        }
                                        if (!$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords) {
                                                $this->fePreview = 0;
@@ -1193,7 +1202,7 @@ class TypoScriptFrontendController {
                        if (!$GLOBALS['BE_USER']->doesUserHaveAccess($this->page, 1)) {
                                // Resetting
                                $this->clear_preview();
-                               $this->fe_user->user['usergroup'] = $fe_user_OLD_USERGROUP;
+                               $this->fe_user->user = $originalFrontendUser;
                                // Fetching the id again, now with the preview settings reset.
                                $this->fetch_the_id();
                        }