forked from cconard96/jamf
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathruleimport.class.php
More file actions
101 lines (92 loc) · 3.27 KB
/
ruleimport.class.php
File metadata and controls
101 lines (92 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* -------------------------------------------------------------------------
* JAMF plugin for GLPI
* -------------------------------------------------------------------------
*
* LICENSE
*
* This file is part of JAMF plugin for GLPI.
*
* JAMF plugin for GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* JAMF plugin for GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with JAMF plugin for GLPI. If not, see <http://www.gnu.org/licenses/>.
* -------------------------------------------------------------------------
* @copyright Copyright (C) 2024-2025 by Teclib'
* @copyright Copyright (C) 2019-2024 by Curtis Conard
* @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
* @link https://github.com/pluginsGLPI/jamf
* -------------------------------------------------------------------------
*/
/**
* PluginJamfRuleImport class. Represents a rule for importing devices into GLPI.
* Determines if the import happens or if it is dropped.
* @since 1.0.0
*/
class PluginJamfRuleImport extends Rule
{
public static $rightname = 'plugin_jamf_ruleimport';
public $can_sort = true;
public function getTitle()
{
return _x('itemtype', 'Device import rules', 'jamf');
}
public function maxActionsCount()
{
return 1;
}
public function getCriterias()
{
return ['name' => [
'field' => 'name',
'name' => _x('field', 'Name', 'jamf'),
'table' => '',
], 'itemtype' => [
'field' => 'itemtype',
'name' => _x('field', 'Item type', 'jamf'),
'table' => '',
'allow_condition' => [Rule::PATTERN_IS, Rule::PATTERN_IS_NOT],
], 'last_inventory' => [
'field' => 'last_inventory',
'name' => _x('field', 'Last inventory', 'jamf'),
'table' => '',
], 'managed' => [
'field' => 'managed',
'name' => _x('field', 'Managed', 'jamf'),
'type' => 'yesno',
'table' => '',
], 'supervised' => [
'field' => 'supervised',
'name' => _x('field', 'Supervised', 'jamf'),
'type' => 'yesno',
'table' => '',
]];
}
public function getActions()
{
return ['_import' => [
'name' => _x('action', 'Import', 'jamf'),
'type' => 'yesno',
]];
}
public function displayAdditionalRuleCondition($condition, $crit, $name, $value, $test = false)
{
if (isset($crit['field']) && $crit['field'] === 'itemtype') {
Dropdown::showFromArray($name, [
Computer::getType() => Computer::getTypeName(1),
Phone::getType() => Phone::getTypeName(1),
]);
return true;
}
return false;
}
}