From d1f24561b35c3e73538bd928c6d301bac50c74e3 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:25:04 +0100 Subject: [PATCH] TASK: Make linting happy for now --- Classes/Controller/BackendController.php | 13 +++++++++++++ .../Containers/Drawer/UserDropDown/UserDropDown.tsx | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index c936599016..143af5b420 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -21,6 +21,7 @@ use Neos\Neos\Domain\Repository\DomainRepository; use Neos\Neos\Domain\Repository\SiteRepository; use Neos\Neos\Domain\Service\NodeTypeNameFactory; +use Neos\Neos\Domain\Service\UserService; use Neos\Neos\Domain\Service\WorkspaceService; use Neos\Neos\FrontendRouting\NodeUriBuilderFactory; use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; @@ -105,6 +106,12 @@ class BackendController extends ActionController */ protected $userProvider; + /** + * @Flow\Inject + * @var UserService + */ + protected $userService; + /** * @Flow\Inject * @var InitialStateProviderInterface @@ -135,6 +142,11 @@ public function indexAction(string $node = null) $contentRepository = $this->contentRepositoryRegistry->get($siteDetectionResult->contentRepositoryId); $nodeAddress = $node !== null ? NodeAddress::fromJsonString($node) : null; + $user = $this->userService->getCurrentUser(); + + if ($user === null) { + $this->redirectToUri($this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos')); + } $this->workspaceService->createPersonalWorkspaceForUserIfMissing($siteDetectionResult->contentRepositoryId, $user); $workspace = $this->workspaceService->getPersonalWorkspaceForUser($siteDetectionResult->contentRepositoryId, $user->getId()); @@ -170,6 +182,7 @@ public function indexAction(string $node = null) $node = $subgraph->findNodeById($nodeAddress->aggregateId); } + // todo duplicate user logic see above $this->userService->getBackendUser() is never null here ... pass the user instead to the method? $user = $this->userProvider->getUser(); if (!$user) { $this->redirectToUri($this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos')); diff --git a/packages/neos-ui/src/Containers/Drawer/UserDropDown/UserDropDown.tsx b/packages/neos-ui/src/Containers/Drawer/UserDropDown/UserDropDown.tsx index e9a26abe94..e2c5f4c48e 100644 --- a/packages/neos-ui/src/Containers/Drawer/UserDropDown/UserDropDown.tsx +++ b/packages/neos-ui/src/Containers/Drawer/UserDropDown/UserDropDown.tsx @@ -8,8 +8,6 @@ * source code. */ import React from 'react'; -// @ts-ignore -import {connect} from 'react-redux'; import {neos} from '@neos-project/neos-ui-decorators'; import {Icon, DropDown} from '@neos-project/react-ui-components';