Skip to content

Commit

Permalink
Fix discoveries type.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Apr 22, 2024
1 parent b5093c0 commit d2653ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/Models/DiscoveriesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function collection(object $resp): array
$this->builder->{$filter->function}($filter->name, $filter->value);
}
}
$instance = & get_instance();
if ($instance->config->product !== 'enterprise') {
$this->builder->where('discoveries.type !=', 'seed');
}
$this->builder->orderBy($resp->meta->sort);
$this->builder->limit($resp->meta->limit, $resp->meta->offset);
$query = $this->builder->get();
Expand All @@ -61,7 +65,6 @@ public function create($data = null): ?int
{
$instance = & get_instance();
$instance->networksModel = new \App\Models\NetworksModel();

if (empty($data)) {
return null;
}
Expand All @@ -75,6 +78,9 @@ public function create($data = null): ?int
\Config\Services::session()->setFlashdata('error', 'Invalid type provided to Discoveries::Create.');
return null;
}
if ($instance->config->product !== 'enterprise' and $data->type === 'seed') {
return null;
}
if (empty($instance->config->discovery_default_scan_option)) {
$instance->config->discovery_default_scan_option = 1;
}
Expand Down Expand Up @@ -775,6 +781,10 @@ public function listUser($where = array(), $orgs = array()): array
$this->builder->join('orgs', 'discoveries.org_id = orgs.id', 'left');
$this->builder->whereIn('orgs.id', $orgs);
$this->builder->where($where);
$instance = & get_instance();
if ($instance->config->product !== 'enterprise') {
$this->builder->where('discoveries.type !=', 'seed');
}
$query = $this->builder->get();
if ($this->sqlError($this->db->error())) {
return array();
Expand Down

0 comments on commit d2653ec

Please sign in to comment.