Skip to content

Commit

Permalink
MAGETWO-56733: [GitHub][PR]Correction: variable naming for user roles…
Browse files Browse the repository at this point in the history
… & role id #4491

- Merge branch 'feature-variable-fix' of https://github.com/MagePsycho/magento2 into MagePsycho-feature-variable-fix
  • Loading branch information
Oleksii Korshenko committed Aug 12, 2016
2 parents 92392cc + e84b5a5 commit ffe77cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/code/Magento/User/Block/User/Edit/Tab/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,19 @@ public function getSelectedRoles($json = false)
//checking if we have this data and we
//don't need load it through resource model
if ($user->hasData('roles')) {
$uRoles = $user->getData('roles');
$userRoles = $user->getData('roles');
} else {
$uRoles = $user->getRoles();
$userRoles = $user->getRoles();
}

if ($json) {
$jsonRoles = [];
foreach ($uRoles as $urid) {
$jsonRoles[$urid] = 0;
foreach ($userRoles as $roleId) {
$jsonRoles[$roleId] = 0;
}
return $this->_jsonEncoder->encode((object)$jsonRoles);
} else {
return $uRoles;
return $userRoles;
}
}
}
6 changes: 3 additions & 3 deletions app/code/Magento/User/Controller/Adminhtml/User/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function execute()
return;
}
$model->setData($this->_getAdminUserData($data));
$uRoles = $this->getRequest()->getParam('roles', []);
if (count($uRoles)) {
$model->setRoleId($uRoles[0]);
$userRoles = $this->getRequest()->getParam('roles', []);
if (count($userRoles)) {
$model->setRoleId($userRoles[0]);
}

/** @var $currentUser \Magento\User\Model\User */
Expand Down

0 comments on commit ffe77cd

Please sign in to comment.