11 class Delete extends \Magento\User\Controller\Adminhtml\User\Role
21 $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
22 $rid = $this->
getRequest()->getParam(
'rid',
false);
24 $currentUser = $this->_userFactory->create()->setId($this->_authSession->getUser()->getId());
26 if (in_array($rid, $currentUser->getRoles())) {
27 $this->messageManager->addError(
__(
'You cannot delete self-assigned roles.'));
28 return $resultRedirect->setPath(
'adminhtml/*/editrole', [
'rid' => $rid]);
33 $this->messageManager->addSuccess(
__(
'You deleted the role.'));
34 }
catch (\Exception $e) {
35 $this->messageManager->addError(
__(
'An error occurred while deleting this role.'));
38 return $resultRedirect->setPath(
"*/*/");
_initRole($requestVariable='rid')