Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

Commit a79ea1a

Browse files
committed
fix: restrict operator for boolean search options
Signed-off-by: Thierry Bugier <[email protected]>
1 parent ede3a56 commit a79ea1a

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

inc/agent.class.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ public function rawSearchOptions() {
830830
'field' => 'is_online',
831831
'name' => __('Is online', 'flyvemdm'),
832832
'datatype' => 'specific',
833+
'searchtype' => ['equals'],
833834
'massiveaction' => false
834835
];
835836

@@ -848,6 +849,7 @@ public function rawSearchOptions() {
848849
'field' => 'has_system_permission',
849850
'name' => __('Has system permission', 'flyvemdm'),
850851
'datatype' => 'bool',
852+
'searchtype' => ['equals'],
851853
'massiveaction' => false
852854
];
853855

@@ -857,6 +859,7 @@ public function rawSearchOptions() {
857859
'field' => 'enroll_status',
858860
'name' => __('Enroll status', 'flyvemdm'),
859861
'datatype' => 'bool',
862+
'searchtype' => ['equals'],
860863
'massiveaction' => false
861864
];
862865

@@ -866,6 +869,7 @@ public function rawSearchOptions() {
866869
'field' => 'wipe',
867870
'name' => __('Wipe requested', 'flyvemdm'),
868871
'datatype' => 'bool',
872+
'searchtype' => ['equals'],
869873
'massiveaction' => false
870874
];
871875

@@ -875,6 +879,7 @@ public function rawSearchOptions() {
875879
'field' => 'lock',
876880
'name' => __('Lock requested', 'flyvemdm'),
877881
'datatype' => 'bool',
882+
'searchtype' => ['equals'],
878883
'massiveaction' => false
879884
];
880885

@@ -2007,4 +2012,25 @@ public static function getSpecificValueToDisplay($field, $values, array $options
20072012
}
20082013
return parent::getSpecificValueToDisplay($field, $values, $options);
20092014
}
2015+
2016+
public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = []) {
2017+
if (!is_array($values)) {
2018+
$values = [$field => $values];
2019+
}
2020+
$options['display'] = false;
2021+
2022+
switch ($field) {
2023+
case 'is_online' :
2024+
return Dropdown::showFromArray($name, [
2025+
'0' => __('No', 'flyvemdm'),
2026+
'1' => __('Yes', 'flyvemdm'),
2027+
], [
2028+
'value' => $values[$field],
2029+
'display_emptychoice' => false,
2030+
'display' => false
2031+
]);
2032+
break;
2033+
}
2034+
return parent::getSpecificValueToSelect($field, $name, $values, $options);
2035+
}
20102036
}

inc/fleet.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ public function rawSearchOptions() {
282282
'field' => 'is_default',
283283
'name' => __('Not managed'),
284284
'datatype' => 'bool',
285+
'searchtype' => ['equals'],
285286
'massiveaction' => false
286287
];
287288

inc/policy.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public function rawSearchOptions() {
174174
'field' => 'is_android_system',
175175
'name' => __('Requires system permission', 'flyvemdm'),
176176
'datatype' => 'bool',
177+
'searchtype' => ['equals'],
177178
'massiveaction' => false,
178179
];
179180

inc/wellknownpath.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function rawSearchOptions() {
118118
'name' => __('default'),
119119
'massiveaction' => false,
120120
'datatype' => 'bool',
121+
'searchtype' => ['equals'],
121122
];
122123

123124
return $tab;

0 commit comments

Comments
 (0)