fix: [attribute search] enforce unpublishedprivate directive

pull/9636/head
iglocska 2024-03-22 15:24:05 +01:00
parent 035b80239a
commit 74579bb1fe
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 11 additions and 2 deletions

View File

@ -1553,13 +1553,22 @@
'fields' => ['id']
];
$subQuery2 = [
'conditions' => ['distribution IN' => [1, 2, 3]],
'conditions' => [
'distribution IN' => [1, 2, 3]
],
'fields' => ['id']
];
$subQuery3 = [
'conditions' => ['Event.distribution' => 4, 'Event.sharing_group_id IN' => $sgids],
'conditions' => [
'Event.distribution' => 4,
'Event.sharing_group_id IN' => $sgids
],
'fields' => ['id']
];
if (Configure::read('MISP.unpublishedprivate')) {
$subQuery2['conditions']['Event.published'] = 1;
$subQuery3['conditions']['Event.published'] = 1;
}
$conditions = [
'OR' => [
$this->subQueryGenerator($this->Event, $subQuery1, 'Attribute.event_id'),