mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
87 lines
2.1 KiB
PHP
87 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\User\Controller\Adminhtml;
|
|
|
|
abstract class User extends \Magento\Backend\App\AbstractAction
|
|
{
|
|
/**
|
|
* Authorization level of a basic admin session
|
|
*
|
|
* @see _isAllowed()
|
|
*/
|
|
const ADMIN_RESOURCE = 'Magento_User::acl_users';
|
|
|
|
/**
|
|
* Core registry
|
|
*
|
|
* @var \Magento\Framework\Registry
|
|
*/
|
|
protected $_coreRegistry;
|
|
|
|
/**
|
|
* User model factory
|
|
*
|
|
* @var \Magento\User\Model\UserFactory
|
|
*/
|
|
protected $_userFactory;
|
|
|
|
/**
|
|
* @param \Magento\Backend\App\Action\Context $context
|
|
* @param \Magento\Framework\Registry $coreRegistry
|
|
* @param \Magento\User\Model\UserFactory $userFactory
|
|
*/
|
|
public function __construct(
|
|
\Magento\Backend\App\Action\Context $context,
|
|
\Magento\Framework\Registry $coreRegistry,
|
|
\Magento\User\Model\UserFactory $userFactory
|
|
) {
|
|
parent::__construct($context);
|
|
$this->_coreRegistry = $coreRegistry;
|
|
$this->_userFactory = $userFactory;
|
|
}
|
|
|
|
/**
|
|
* @return $this
|
|
*/
|
|
protected function _initAction()
|
|
{
|
|
$this->_view->loadLayout();
|
|
$this->_setActiveMenu(
|
|
'Magento_User::system_acl_users'
|
|
)->_addBreadcrumb(
|
|
__('System'),
|
|
__('System')
|
|
)->_addBreadcrumb(
|
|
__('Permissions'),
|
|
__('Permissions')
|
|
)->_addBreadcrumb(
|
|
__('Users'),
|
|
__('Users')
|
|
);
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Retrieve well-formed admin user data from the form input
|
|
*
|
|
* @param array $data
|
|
* @return array
|
|
*/
|
|
protected function _getAdminUserData(array $data)
|
|
{
|
|
if (isset($data['password']) && $data['password'] === '') {
|
|
unset($data['password']);
|
|
}
|
|
if (!isset($data['password'])
|
|
&& isset($data['password_confirmation'])
|
|
&& $data['password_confirmation'] === ''
|
|
) {
|
|
unset($data['password_confirmation']);
|
|
}
|
|
return $data;
|
|
}
|
|
}
|