Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Role.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
17  const ADMIN_RESOURCE = 'Magento_User::acl_roles';
18 
24  protected $_coreRegistry = null;
25 
31  protected $_roleFactory;
32 
38  protected $_userFactory;
39 
45  protected $_rulesFactory;
46 
52  protected $_authSession;
53 
57  protected $_filterManager;
58 
68  public function __construct(
69  \Magento\Backend\App\Action\Context $context,
70  \Magento\Framework\Registry $coreRegistry,
71  \Magento\Authorization\Model\RoleFactory $roleFactory,
72  \Magento\User\Model\UserFactory $userFactory,
73  \Magento\Authorization\Model\RulesFactory $rulesFactory,
74  \Magento\Backend\Model\Auth\Session $authSession,
75  \Magento\Framework\Filter\FilterManager $filterManager
76  ) {
77  parent::__construct($context);
78  $this->_coreRegistry = $coreRegistry;
79  $this->_roleFactory = $roleFactory;
80  $this->_userFactory = $userFactory;
81  $this->_rulesFactory = $rulesFactory;
82  $this->_authSession = $authSession;
83  $this->_filterManager = $filterManager;
84  }
85 
91  protected function _initAction()
92  {
93  $this->_view->loadLayout();
94  $this->_setActiveMenu('Magento_User::system_acl_roles');
95  $this->_addBreadcrumb(__('System'), __('System'));
96  $this->_addBreadcrumb(__('Permissions'), __('Permissions'));
97  $this->_addBreadcrumb(__('Roles'), __('Roles'));
98  return $this;
99  }
100 
107  protected function _initRole($requestVariable = 'rid')
108  {
109  $role = $this->_roleFactory->create()->load($this->getRequest()->getParam($requestVariable));
110  // preventing edit of relation role
111  if ($role->getId() && $role->getRoleType() != RoleGroup::ROLE_TYPE) {
112  $role->unsetData($role->getIdFieldName());
113  }
114 
115  $this->_coreRegistry->register('current_role', $role);
116  return $this->_coreRegistry->registry('current_role');
117  }
118 }
__()
Definition: __.php:13
_initRole($requestVariable='rid')
Definition: Role.php:107
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Authorization\Model\RoleFactory $roleFactory, \Magento\User\Model\UserFactory $userFactory, \Magento\Authorization\Model\RulesFactory $rulesFactory, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\Filter\FilterManager $filterManager)
Definition: Role.php:68
_addBreadcrumb($label, $title, $link=null)