Skip to content

Commit

Permalink
Fixed total in get-roles action: use right variables roles. (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmalyk authored Apr 12, 2021
1 parent 5cc14fd commit 2a6aa3a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,21 @@ public function getUsersAction(Request $request) {
*/
public function getRolesAction() {

$users = [];
$roles = [];

$rolesList = new \Pimcore\Model\User\Role\Listing();
$rolesList->setCondition('type = "role"');
$rolesList->addConditionParam("CONCAT(',', permissions, ',') LIKE ?", '%,bundle_advancedsearch_search,%');
$rolesList->load();

$roles = [];
foreach ($rolesList->getRoles() as $role) {
$roles[] = [
'id' => $role->getId(),
'label' => $role->getName()
];
}

return $this->adminJson(['success' => true, 'total' => count($users), 'data' => $roles]);
return $this->adminJson(['success' => true, 'total' => count($roles), 'data' => $roles]);
}


Expand Down

0 comments on commit 2a6aa3a

Please sign in to comment.