Skip to content

Commit 5dd689d

Browse files
author
Hwashiang Yu
committed
MAGETWO-98157: User Role Template Update
- Resolved integration failures from incorrect helper method - Resolved invalid input static test
1 parent 7cf4e48 commit 5dd689d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/code/Magento/User/Block/Role/Grid/User.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function _prepareColumns()
185185
*/
186186
public function getGridUrl()
187187
{
188-
$roleId = $this->getRequest()->getParam('rid');
188+
$roleId = $this->_escaper->escapeJs($this->escapeHtml($this->getRequest()->getParam('rid')));
189189
return $this->getUrl('*/*/editrolegrid', ['rid' => $roleId]);
190190
}
191191

@@ -202,14 +202,14 @@ public function getUsers($json = false)
202202
if ($json) {
203203
return $this->getJSONString($inRoleUser);
204204
}
205-
return $this->helper(\Magento\Framework\EscapeHelper::class)->escapeJs($this->escapeHtml($inRoleUser));
205+
return $this->_escaper->escapeJs($this->escapeHtml($inRoleUser));
206206
}
207207
$roleId = $this->getRoleId();
208208
$users = $this->getUsersFormData();
209209
if (false === $users) {
210210
$users = $this->_roleFactory->create()->setId($roleId)->getRoleUsers();
211211
}
212-
if (sizeof($users) > 0) {
212+
if (!empty($users)) {
213213
if ($json) {
214214
$jsonUsers = [];
215215
foreach ($users as $userid) {
@@ -243,6 +243,7 @@ protected function getUsersFormData()
243243
* Restore Users Form Data from the registry
244244
*
245245
* @return array|bool
246+
* @SuppressWarnings(PHPMD.DiscouragedFunctionsSniff)
246247
*/
247248
protected function restoreUsersFormData()
248249
{

app/code/Magento/User/Block/User/Edit/Tab/Roles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function getSelectedRoles($json = false)
155155
$result = json_decode($userRoles);
156156
return $result ? $this->_jsonEncoder->encode($result) : '{}';
157157
}
158-
return $this->helper(\Magento\Framework\EscapeHelper::class)->escapeJs($this->escapeHtml($userRoles));
158+
return $this->_escaper->escapeJs($this->escapeHtml($userRoles));
159159
}
160160
/* @var $user \Magento\User\Model\User */
161161
$user = $this->_coreRegistry->registry('permissions_user');

0 commit comments

Comments
 (0)