user type filter fix

This commit is contained in:
Yuri Kuznetsov
2021-01-28 10:32:48 +02:00
parent 675a2811d4
commit b9c2cc2c4f
6 changed files with 98 additions and 5 deletions

View File

@@ -112,4 +112,21 @@ class User extends \Espo\Core\Controllers\Record
{
if (!$this->getUser()->isAdmin()) throw new Forbidden();
}
protected function fetchListParamsFromRequest(&$params, $request, $data)
{
parent::fetchListParamsFromRequest($params, $request, $data);
$userType = $request->get('userType');
if ($userType) {
$params['where'] = $params['where'] ?? [];
$params['where'][] = [
'type' => 'isOfType',
'attribute' => 'id',
'value' => $userType,
];
}
}
}