diff --git a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php b/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php index b7aa3487672b2..fd454f96abf95 100755 --- a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php +++ b/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php @@ -9,6 +9,8 @@ /** * Login as customer log + * + * @api */ class Login extends \Magento\Backend\Block\Widget\Grid\Container { diff --git a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Index.php b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Index.php index 008e5fa3cfd87..55d89dedf09f1 100755 --- a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Index.php +++ b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Index.php @@ -7,11 +7,14 @@ namespace Magento\LoginAsCustomer\Controller\Adminhtml\Login; +use Magento\Backend\App\Action\Context; +use Magento\Backend\Model\View\Result\Page; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Backend\App\Action; +use Magento\LoginAsCustomer\Model\Login; /** * Login As Customer log grid action @@ -27,18 +30,17 @@ class Index extends Action implements HttpGetActionInterface, HttpPostActionInte const ADMIN_RESOURCE = 'Magento_LoginAsCustomer::login_log'; /** - * @var \Magento\LoginAsCustomer\Model\Login + * @var Login */ private $loginModel; /** - * Index constructor. - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\LoginAsCustomer\Model\Login $loginModel + * @param Context $context + * @param Login $loginModel */ public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\LoginAsCustomer\Model\Login $loginModel + Context $context, + Login $loginModel ) { parent::__construct($context); $this->loginModel = $loginModel; @@ -59,6 +61,7 @@ public function execute():ResultInterface $this->loginModel->deleteNotUsed(); + /** @var Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $resultPage->setActiveMenu('Magento_LoginAsCustomer::login_log') ->addBreadcrumb(__('Customer'), __('Login As Customer Log')); diff --git a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Login.php b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Login.php index 9f653c17907d6..8c3f0969cfbe6 100755 --- a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Login.php +++ b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Login.php @@ -82,7 +82,7 @@ public function __construct( * * @return ResultInterface */ - public function execute():ResultInterface + public function execute(): ResultInterface { $request = $this->getRequest(); $customerId = (int) $request->getParam('customer_id'); @@ -94,13 +94,13 @@ public function execute():ResultInterface $resultRedirect = $this->resultRedirectFactory->create(); if (!$this->config->isEnabled()) { - $this->messageManager->addErrorMessage(__('Login As Customer is disabled, to enable the extension please navigate to Stores > Configuration > Customers > Login As Customer.')); + $this->messageManager->addErrorMessage(__('Login As Customer is disabled.')); return $resultRedirect->setPath('customer/index/index'); } $customerStoreId = $request->getParam('store_id'); - if (!isset($customerStoreId) && $this->config->getStoreViewLogin()) { + if (!isset($customerStoreId) && $this->config->isManualChoiceEnabled()) { $this->messageManager->addNoticeMessage(__('Please select a Store View to login in.')); return $resultRedirect->setPath('loginascustomer/login/manual', ['entity_id' => $customerId ]); } diff --git a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Manual.php b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Manual.php index 82ca675411f39..93ef202071495 100755 --- a/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Manual.php +++ b/app/code/Magento/LoginAsCustomer/Controller/Adminhtml/Login/Manual.php @@ -7,6 +7,7 @@ namespace Magento\LoginAsCustomer\Controller\Adminhtml\Login; +use Magento\Backend\Model\View\Result\Page; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\App\Action\HttpGetActionInterface; @@ -31,6 +32,7 @@ class Manual extends Action implements HttpGetActionInterface */ public function execute():ResultInterface { + /** @var Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $resultPage->setActiveMenu('Magento_LoginAsCustomer::login_button') ->addBreadcrumb(__('Customer'), __('Login As Customer Log'), __('Store View To Login In')); diff --git a/app/code/Magento/LoginAsCustomer/Controller/Login/Index.php b/app/code/Magento/LoginAsCustomer/Controller/Login/Index.php index 2bfa06b47f4c6..dc3affa70e3a2 100755 --- a/app/code/Magento/LoginAsCustomer/Controller/Login/Index.php +++ b/app/code/Magento/LoginAsCustomer/Controller/Login/Index.php @@ -7,74 +7,109 @@ namespace Magento\LoginAsCustomer\Controller\Login; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\Framework\App\Action\Action; +use Magento\Framework\Message\ManagerInterface; +use Magento\LoginAsCustomer\Model\Login; +use Psr\Log\LoggerInterface; /** * Login As Customer storefront login action */ -class Index extends Action implements HttpGetActionInterface +class Index implements HttpGetActionInterface { /** - * @var \Magento\LoginAsCustomer\Model\Login + * @var ResultFactory + */ + private $resultFactory; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @var Login */ private $loginModel; + /** + * @var ManagerInterface + */ + private $messageManager; + + /** + * @var LoggerInterface + */ + private $logger; /** - * Index constructor. - * @param \Magento\Framework\App\Action\Context $context - * @param \Magento\LoginAsCustomer\Model\Login $loginModel + * @param ResultFactory $resultFactory + * @param RequestInterface $request + * @param Login $loginModel + * @param ManagerInterface $messageManager + * @param LoggerInterface $logger */ public function __construct( - \Magento\Framework\App\Action\Context $context, - \Magento\LoginAsCustomer\Model\Login $loginModel + ResultFactory $resultFactory, + RequestInterface $request, + Login $loginModel, + ManagerInterface $messageManager, + LoggerInterface $logger ) { - parent::__construct($context); + $this->resultFactory = $resultFactory; + $this->request = $request; $this->loginModel = $loginModel; + $this->messageManager = $messageManager; + $this->logger = $logger; } + /** * Login As Customer storefront login * * @return ResultInterface */ - public function execute():ResultInterface + public function execute(): ResultInterface { + /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - try { - $login = $this->_initLogin(); - /* Log in */ + try { + $login = $this->initLogin(); $login->authenticateCustomer(); + $this->messageManager->addSuccessMessage( __('You are logged in as customer: %1', $login->getCustomer()->getName()) ); + $resultRedirect->setPath('*/*/proceed'); + } catch (LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); - $resultRedirect->setPath('/'); - return $resultRedirect; - } catch (\Exception $e) { - $this->messageManager->addErrorMessage($e->getMessage()); - } + $this->logger->error($e->getMessage()); - $resultRedirect->setPath('*/*/proceed'); + $this->messageManager->addErrorMessage(__('Cannot login to account.')); + $resultRedirect->setPath('/'); + } return $resultRedirect; } /** * Init login info - * @return \Magento\LoginAsCustomer\Model\Login + * + * @return Login + * @throws LocalizedException */ - private function _initLogin(): \Magento\LoginAsCustomer\Model\Login + private function initLogin(): Login { - $secret = $this->getRequest()->getParam('secret'); + $secret = $this->request->getParam('secret'); if (!$secret) { - throw LocalizedException(__('Cannot login to account. No secret key provided.')); + throw new LocalizedException(__('Cannot login to account. No secret key provided.')); } $login = $this->loginModel->loadNotUsed($secret); @@ -82,7 +117,7 @@ private function _initLogin(): \Magento\LoginAsCustomer\Model\Login if ($login->getId()) { return $login; } else { - throw LocalizedException(__('Cannot login to account. Secret key is not valid')); + throw new LocalizedException(__('Cannot login to account. Secret key is not valid')); } } } diff --git a/app/code/Magento/LoginAsCustomer/Controller/Login/Proceed.php b/app/code/Magento/LoginAsCustomer/Controller/Login/Proceed.php index c5b2127133594..45e2c3f9ce921 100755 --- a/app/code/Magento/LoginAsCustomer/Controller/Login/Proceed.php +++ b/app/code/Magento/LoginAsCustomer/Controller/Login/Proceed.php @@ -4,26 +4,39 @@ * See COPYING.txt for license details. */ declare(strict_types=1); + namespace Magento\LoginAsCustomer\Controller\Login; use Magento\Backend\Model\View\Result\Page; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\Framework\App\Action\Action; /** * Login as customer proxy page * Allows running JavaScript to load customer data to the browser local storage */ -class Proceed extends Action implements HttpGetActionInterface +class Proceed implements HttpGetActionInterface { + /** + * @var ResultFactory + */ + private $resultFactory; + + /** + * @param ResultFactory $resultFactory + */ + public function __construct(ResultFactory $resultFactory) + { + $this->resultFactory = $resultFactory; + } + /** * Proxy page * * @return ResultInterface */ - public function execute():ResultInterface + public function execute(): ResultInterface { /** @var Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); diff --git a/app/code/Magento/LoginAsCustomer/CustomerData/LoginAsCustomer.php b/app/code/Magento/LoginAsCustomer/CustomerData/LoginAsCustomer.php index 56af5c948bf69..f7153dc6c2b75 100644 --- a/app/code/Magento/LoginAsCustomer/CustomerData/LoginAsCustomer.php +++ b/app/code/Magento/LoginAsCustomer/CustomerData/LoginAsCustomer.php @@ -13,6 +13,8 @@ /** * Customer data for the logged_as_customer section + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class LoginAsCustomer implements SectionSourceInterface { @@ -41,6 +43,7 @@ public function __construct( /** * Retrieve private customer data for the logged_as_customer section + * * @return array */ public function getSectionData():array @@ -50,8 +53,8 @@ public function getSectionData():array } return [ - 'admin_user_id' => $this->customerSession->getLoggedAsCustomerAdmindId(), - 'website_name' => $this->storeManager->getWebsite()->getName() + 'adminUserId' => $this->customerSession->getLoggedAsCustomerAdmindId(), + 'websiteName' => $this->storeManager->getWebsite()->getName() ]; } } diff --git a/app/code/Magento/LoginAsCustomer/Model/Config.php b/app/code/Magento/LoginAsCustomer/Model/Config.php index e1b7bcfbcaa5a..7b34cc8dcfd7c 100644 --- a/app/code/Magento/LoginAsCustomer/Model/Config.php +++ b/app/code/Magento/LoginAsCustomer/Model/Config.php @@ -8,33 +8,32 @@ namespace Magento\LoginAsCustomer\Model; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Store\Model\ScopeInterface; use Magento\Framework\App\ProductMetadataInterface; +use Magento\Store\Model\ScopeInterface; /** - * Class Config + * LoginAsCustomer module config model. */ class Config { /** * Extension config path */ - private const XML_PATH_EXTENSION_ENABLED = 'mfloginascustomer/general/enabled'; - private const XML_PATH_KEY = 'mfloginascustomer/general/key'; - private const STORE_VIEW_TO_LOGIN_IN = 'mfloginascustomer/general/store_view_login'; + private const XML_PATH_EXTENSION_ENABLED = 'loginascustomer/general/enabled'; + private const ENABLE_STORE_VIEW_MANUAL_CHOICE = 'loginascustomer/general/enable_store_view_manual_choice'; /** * @var ScopeConfigInterface */ private $scopeConfig; + /** * @var \Magento\Framework\App\ProductMetadataInterface */ private $metadata; /** - * Config constructor. * @param ScopeConfigInterface $scopeConfig * @param ProductMetadataInterface $metadata */ @@ -47,37 +46,30 @@ public function __construct( } /** - * Retrieve store config value - * @param string $path - * @param null $storeId - * @return mixed - */ - public function getConfig($path, $storeId = null) - { - return $this->scopeConfig->getValue( - $path, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } - - /** + * Check if Login As Customer extension is enabled. + * * @return bool */ - public function isEnabled():bool + public function isEnabled(): bool { - return (bool)$this->getConfig( - self::XML_PATH_EXTENSION_ENABLED + return (bool)$this->scopeConfig->getValue( + self::XML_PATH_EXTENSION_ENABLED, + ScopeInterface::SCOPE_STORE, + null ); } /** + * Check if store view manual choice is enabled. + * * @return bool */ - public function getStoreViewLogin(): bool + public function isManualChoiceEnabled(): bool { - return (bool)$this->getConfig( - self::STORE_VIEW_TO_LOGIN_IN + return (bool)$this->scopeConfig->getValue( + self::ENABLE_STORE_VIEW_MANUAL_CHOICE, + ScopeInterface::SCOPE_STORE, + null ); } } diff --git a/app/code/Magento/LoginAsCustomer/Model/PageCache/ConfigPlugin.php b/app/code/Magento/LoginAsCustomer/Model/PageCache/ConfigPlugin.php index 913357eff6409..63aea9d8f05e3 100644 --- a/app/code/Magento/LoginAsCustomer/Model/PageCache/ConfigPlugin.php +++ b/app/code/Magento/LoginAsCustomer/Model/PageCache/ConfigPlugin.php @@ -9,6 +9,8 @@ /** * Page cache config plugin + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class ConfigPlugin { @@ -44,12 +46,14 @@ public function __construct( * @param \Magento\PageCache\Model\Config $subject * @param bool $result * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterIsEnabled(\Magento\PageCache\Model\Config $subject, $result): bool { if ($result) { + $disable = $this->_scopeConfig->getValue( - 'mfloginascustomer/general/disable_page_cache', + 'loginascustomer/general/disable_page_cache', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $adminId = $this->_customerSession->getLoggedAsCustomerAdmindId(); diff --git a/app/code/Magento/LoginAsCustomer/Observer/WbsiterestrictionFrontendObserver.php b/app/code/Magento/LoginAsCustomer/Observer/WbsiterestrictionFrontendObserver.php deleted file mode 100644 index 298282f69d7f4..0000000000000 --- a/app/code/Magento/LoginAsCustomer/Observer/WbsiterestrictionFrontendObserver.php +++ /dev/null @@ -1,30 +0,0 @@ -getController(); - if ($controller->getRequest()->getModuleName() == 'loginascustomer') { - $result = $observer->getResult(); - $result->setData('should_proceed', false); - } - } -} diff --git a/app/code/Magento/LoginAsCustomer/Plugin/AdminAddCommentOnOrderPlacementPlugin.php b/app/code/Magento/LoginAsCustomer/Plugin/AdminAddCommentOnOrderPlacementPlugin.php index e87e5553ef4c8..da6cbd4ef706b 100644 --- a/app/code/Magento/LoginAsCustomer/Plugin/AdminAddCommentOnOrderPlacementPlugin.php +++ b/app/code/Magento/LoginAsCustomer/Plugin/AdminAddCommentOnOrderPlacementPlugin.php @@ -39,16 +39,18 @@ public function __construct( public function afterPlace(Order $subject, Order $result): Order { $adminUser = $this->userSession->getUser(); - $subject->addCommentToStatusHistory( - 'Order Placed by Store Administrator', - false, - true - )->setIsCustomerNotified(false); - $subject->addCommentToStatusHistory( - "Order Placed by {$adminUser->getFirstName()} {$adminUser->getLastName()} using Admin Panel", - false, - false - )->setIsCustomerNotified(false); + if ($adminUser) { + $subject->addCommentToStatusHistory( + 'Order Placed by Store Administrator', + false, + true + )->setIsCustomerNotified(false); + $subject->addCommentToStatusHistory( + "Order Placed by {$adminUser->getFirstName()} {$adminUser->getLastName()} using Admin Panel", + false, + false + )->setIsCustomerNotified(false); + } return $result; } diff --git a/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php b/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php index 20b0332ae76d2..64a0ad8a872a0 100644 --- a/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php +++ b/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php @@ -7,14 +7,12 @@ namespace Magento\LoginAsCustomer\Plugin\Button; -use \Magento\LoginAsCustomerAdvanced\Controller\Adminhtml\Order\Login as LoginController; -use \Magento\Backend\Block\Widget\Button\Toolbar\Interceptor; -use \Magento\Framework\View\Element\AbstractBlock; -use \Magento\Backend\Block\Widget\Button\ButtonList; +use Magento\Backend\Block\Widget\Button\ButtonList; +use Magento\Backend\Block\Widget\Button\Toolbar; +use Magento\Framework\View\Element\AbstractBlock; /** - * Class ToolbarPlugin - * @package Magento\LoginAsCustomerAdvanced\Plugin\Button + * Plugin for \Magento\Backend\Block\Widget\Button\Toolbar. */ class ToolbarPlugin { @@ -42,12 +40,15 @@ public function __construct( } /** - * @param \Magento\Backend\Block\Widget\Button\Toolbar\Interceptor $subject + * Add Login As Customer button. + * + * @param \Magento\Backend\Block\Widget\Button\Toolbar $subject * @param \Magento\Framework\View\Element\AbstractBlock $context * @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforePushButtons( - Interceptor $subject, + Toolbar $subject, AbstractBlock $context, ButtonList $buttonList ):void { @@ -71,7 +72,11 @@ public function beforePushButtons( ]); $buttonList->add( 'guest_to_customer', - ['label' => __('Login As Customer'), 'onclick' => 'window.open(\'' . $buttonUrl . '\')', 'class' => 'reset'], + [ + 'label' => __('Login As Customer'), + 'onclick' => 'window.open(\'' . $buttonUrl . '\')', + 'class' => 'reset' + ], -1 ); } diff --git a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Customer/Edit/Login.php b/app/code/Magento/LoginAsCustomer/Ui/Customer/Component/Control/LoginAsCustomerButton.php old mode 100755 new mode 100644 similarity index 67% rename from app/code/Magento/LoginAsCustomer/Block/Adminhtml/Customer/Edit/Login.php rename to app/code/Magento/LoginAsCustomer/Ui/Customer/Component/Control/LoginAsCustomerButton.php index fe22450cda1ad..a37d8613e0019 --- a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Customer/Edit/Login.php +++ b/app/code/Magento/LoginAsCustomer/Ui/Customer/Component/Control/LoginAsCustomerButton.php @@ -5,60 +5,60 @@ */ declare(strict_types=1); -namespace Magento\LoginAsCustomer\Block\Adminhtml\Customer\Edit; +namespace Magento\LoginAsCustomer\Ui\Customer\Component\Control; use Magento\Customer\Block\Adminhtml\Edit\GenericButton; use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; /** - * Login as customer button + * Login As Customer button UI component. */ -class Login extends GenericButton implements ButtonProviderInterface +class LoginAsCustomerButton extends GenericButton implements ButtonProviderInterface { /** * @var \Magento\Framework\AuthorizationInterface */ - private $_authorization; + private $authorization; /** - * Constructor - * * @param \Magento\Backend\Block\Widget\Context $context * @param \Magento\Framework\Registry $registry - * @param AccountManagementInterface $customerAccountManagement */ public function __construct( \Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry ) { parent::__construct($context, $registry); - $this->_authorization = $context->getAuthorization(); + $this->authorization = $context->getAuthorization(); } /** - * @return array + * @inheritdoc */ public function getButtonData(): array { $customerId = $this->getCustomerId(); $data = []; - $canModify = $customerId && $this->_authorization->isAllowed('Magento_LoginAsCustomer::login_button'); + $canModify = $customerId && $this->authorization->isAllowed('Magento_LoginAsCustomer::login_button'); if ($canModify) { $data = [ 'label' => __('Login As Customer'), 'class' => 'login login-button', - 'on_click' => 'window.open( \'' . $this->getInvalidateTokenUrl() . + 'on_click' => 'window.open( \'' . $this->getLoginUrl() . '\')', 'sort_order' => 70, ]; } + return $data; } /** + * Get Login As Customer login url. + * * @return string */ - public function getInvalidateTokenUrl(): string + public function getLoginUrl(): string { return $this->getUrl('loginascustomer/login/login', ['customer_id' => $this->getCustomerId()]); } diff --git a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Store/SaveButton.php b/app/code/Magento/LoginAsCustomer/Ui/Store/Component/Control/LoginAsCustomerButton.php old mode 100755 new mode 100644 similarity index 75% rename from app/code/Magento/LoginAsCustomer/Block/Adminhtml/Store/SaveButton.php rename to app/code/Magento/LoginAsCustomer/Ui/Store/Component/Control/LoginAsCustomerButton.php index 1403c3bfb9de7..4d7aebc9c0d66 --- a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Store/SaveButton.php +++ b/app/code/Magento/LoginAsCustomer/Ui/Store/Component/Control/LoginAsCustomerButton.php @@ -5,16 +5,18 @@ */ declare(strict_types=1); -namespace Magento\LoginAsCustomer\Block\Adminhtml\Store; +namespace Magento\LoginAsCustomer\Ui\Store\Component\Control; use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; /** - * Class SaveButton + * Login As Customer button UI component. */ -class SaveButton implements ButtonProviderInterface +class LoginAsCustomerButton implements ButtonProviderInterface { /** + * Get button data + * * @return array */ public function getButtonData(): array @@ -30,4 +32,3 @@ public function getButtonData(): array ]; } } - diff --git a/app/code/Magento/LoginAsCustomer/Ui/DataProvider/Store/Form/StoreDataProvider.php b/app/code/Magento/LoginAsCustomer/Ui/Store/DataProvider/Form/StoreDataProvider.php similarity index 87% rename from app/code/Magento/LoginAsCustomer/Ui/DataProvider/Store/Form/StoreDataProvider.php rename to app/code/Magento/LoginAsCustomer/Ui/Store/DataProvider/Form/StoreDataProvider.php index a9316fb5e1504..f06458ed72e98 100644 --- a/app/code/Magento/LoginAsCustomer/Ui/DataProvider/Store/Form/StoreDataProvider.php +++ b/app/code/Magento/LoginAsCustomer/Ui/Store/DataProvider/Form/StoreDataProvider.php @@ -4,11 +4,15 @@ * See COPYING.txt for license details. */ declare(strict_types=1); -namespace Magento\LoginAsCustomer\Ui\DataProvider\Store\Form; + +namespace Magento\LoginAsCustomer\Ui\Store\DataProvider\Form; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Ui\DataProvider\AbstractDataProvider; +/** + * Login As Customer store view form data provider. + */ class StoreDataProvider extends AbstractDataProvider { /** @@ -30,5 +34,4 @@ public function __construct( $this->collection = $collectionFactory->create(); parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); } - } diff --git a/app/code/Magento/LoginAsCustomer/composer.json b/app/code/Magento/LoginAsCustomer/composer.json index 5b0ade832bbcd..71813cebf4581 100755 --- a/app/code/Magento/LoginAsCustomer/composer.json +++ b/app/code/Magento/LoginAsCustomer/composer.json @@ -2,14 +2,24 @@ "name": "magento/module-login-as-customer", "description": "Allow for admin to enter a customer account", "require": { + "php": "~7.1.3||~7.2.0||~7.3.0", "magento/framework": "*", "magento/module-backend": "*", - "magento/module-sales": "*", + "magento/module-checkout": "*", "magento/module-customer": "*", - "magento/module-checkout": "*" + "magento/module-sales": "*", + "magento/module-store": "*", + "magento/module-ui": "*", + "magento/module-user": "*" + }, + "suggest": { + "magento/module-page-cache": "*" }, "type": "magento2-module", - "version": "2.2.1", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], "autoload": { "files": [ "registration.php" ], "psr-4": { diff --git a/app/code/Magento/LoginAsCustomer/etc/adminhtml/system.xml b/app/code/Magento/LoginAsCustomer/etc/adminhtml/system.xml index f807ec6d366ac..bfb90dc3413e7 100755 --- a/app/code/Magento/LoginAsCustomer/etc/adminhtml/system.xml +++ b/app/code/Magento/LoginAsCustomer/etc/adminhtml/system.xml @@ -7,7 +7,7 @@ --> -
+
separator-top customer @@ -23,7 +23,7 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\LoginAsCustomer\Model\Config\Source\StoreViewLogin - + 1 - + diff --git a/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml b/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml index 5f0f784e051e3..1cf46eadddc2c 100755 --- a/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml +++ b/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml @@ -13,7 +13,7 @@ - Magento\LoginAsCustomer\CustomerData\LoginAsCustomer + Magento\LoginAsCustomer\CustomerData\LoginAsCustomer diff --git a/app/code/Magento/LoginAsCustomer/etc/frontend/events.xml b/app/code/Magento/LoginAsCustomer/etc/frontend/events.xml deleted file mode 100644 index 895bba76700b2..0000000000000 --- a/app/code/Magento/LoginAsCustomer/etc/frontend/events.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/app/code/Magento/LoginAsCustomer/etc/webrestrictions.xml b/app/code/Magento/LoginAsCustomer/etc/webrestrictions.xml deleted file mode 100644 index 5d909de63d123..0000000000000 --- a/app/code/Magento/LoginAsCustomer/etc/webrestrictions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml index 6f400c0e5c601..e298729b5422b 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> - + diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml index 8f38fab2e2e7a..b75a5b0a68621 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml @@ -18,7 +18,7 @@ - + ID login_id @@ -26,7 +26,7 @@ col-id - + Customer ID customer_id @@ -34,7 +34,7 @@ col-title - + Customer Email email @@ -42,7 +42,7 @@ col-title - + Admin ID admin_id @@ -50,7 +50,7 @@ col-title - + Admin Name username @@ -58,7 +58,7 @@ col-title - + Logged In created_at diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml index 82988c801ef7d..55cbb7e55cfa8 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml @@ -5,10 +5,12 @@ * See COPYING.txt for license details. */ --> -
- - - Magento\LoginAsCustomer\Block\Adminhtml\Customer\Edit\Login - - + + + +