CS filtering and constant

This commit is contained in:
fbsanchez 2019-07-03 16:38:26 +02:00
parent 18d8f90f90
commit 07edee619a
2 changed files with 6 additions and 1 deletions

View File

@ -602,6 +602,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3);
define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
// Discovery task descriptions.
define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute');
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');

View File

@ -72,6 +72,10 @@ function credentials_get_all(
throw new Exception('[credential_get_all] Fields must be an array or "count".');
}
if (isset($filter['product']) && !empty($filter['product'])) {
$sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
}
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
$sql_filters[] = vsprintf(
' AND (lower(cs.username) like lower("%%%s%%")
@ -163,7 +167,7 @@ function credentials_get_all(
%s
%s',
join(',', $fields),
join(',', $sql_filters),
join(' ', $sql_filters),
$order_by,
$pagination
);