Skip to content

Commit

Permalink
Correction: variable naming for user roles & role id
Browse files Browse the repository at this point in the history
  • Loading branch information
MagePsycho committed May 13, 2016
1 parent a545a9a commit e84b5a5
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 @@ -143,19 +143,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 @@ -26,9 +26,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 e84b5a5

Please sign in to comment.