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

Commit 0cca6be

Browse files
committed
feat(policy): redesign use TLS policy
Signed-off-by: Thierry Bugier <[email protected]>
1 parent fb3a8b5 commit 0cca6be

6 files changed

+28
-10
lines changed

inc/agent.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ public function cleanupSubtopics() {
14751475
/**
14761476
* list of topics to cleanup on unenrollment or on enrollment
14771477
*
1478-
* @return string[]
1478+
* @return array
14791479
*/
14801480
public static function getTopicsToCleanup() {
14811481
$policy = new PluginFlyvemdmPolicy();

inc/policybase.class.php

+11-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ abstract class PluginFlyvemdmPolicyBase implements PluginFlyvemdmPolicyInterface
6969
protected $specificStatuses = [];
7070

7171
/**
72-
* get common task statuses
72+
* Gets common task statuses
73+
*
7374
* @return array
7475
*/
7576
public static final function getEnumBaseTaskStatus() {
@@ -89,8 +90,9 @@ public static final function getEnumBaseTaskStatus() {
8990
}
9091

9192
/**
92-
* get specific task statuses
93+
* Gets specific task statuses
9394
* To be overriden in child class
95+
*
9496
* @return array
9597
*/
9698
public static function getEnumSpecificStatus() {
@@ -109,14 +111,15 @@ public function __construct(PluginFlyvemdmPolicy $policy) {
109111
* JSON decode properties for the policy and merges them with default values
110112
* @param string $properties
111113
* @param array $defaultProperties
114+
*
112115
* @return array
113116
*/
114117
protected function jsonDecodeProperties($properties, array $defaultProperties) {
115118
if (empty($properties)) {
116119
return $defaultProperties;
117-
} else {
118-
$propertyCollection = json_decode($properties, true);
119120
}
121+
122+
$propertyCollection = json_decode($properties, true);
120123
if (empty($propertyCollection)) {
121124
return $defaultProperties;
122125
}
@@ -130,6 +133,7 @@ protected function jsonDecodeProperties($properties, array $defaultProperties) {
130133
* @param mixed $itemtype
131134
* @param integer $itemId
132135
* @param PluginFlyvemdmNotifiableInterface $notifiable
136+
*
133137
* @return bool
134138
*/
135139
public function canApply($value, $itemtype, $itemId, PluginFlyvemdmNotifiableInterface $notifiable) {
@@ -141,6 +145,7 @@ public function canApply($value, $itemtype, $itemId, PluginFlyvemdmNotifiableInt
141145
* @param mixed $itemtype
142146
* @param integer $itemId
143147
* @param PluginFlyvemdmNotifiableInterface $notifiable
148+
*
144149
* @return boolean
145150
*/
146151
public function unicityCheck($value, $itemtype, $itemId, PluginFlyvemdmNotifiableInterface $notifiable) {
@@ -161,6 +166,7 @@ public function unicityCheck($value, $itemtype, $itemId, PluginFlyvemdmNotifiabl
161166
* @param mixed $itemtype
162167
* @param integer $itemId
163168
* @param PluginFlyvemdmNotifiableInterface $notifiable
169+
*
164170
* @return boolean
165171
*/
166172
public function conflictCheck($value, $itemtype, $itemId, PluginFlyvemdmNotifiableInterface $notifiable) {
@@ -171,6 +177,7 @@ public function conflictCheck($value, $itemtype, $itemId, PluginFlyvemdmNotifiab
171177
* @param mixed $value
172178
* @param mixed $itemtype
173179
* @param integer $itemId
180+
*
174181
* @return bool
175182
*/
176183
public function integrityCheck($value, $itemtype, $itemId) {

inc/policydeployapplication.class.php

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function integrityCheck($value, $itemtype, $itemId) {
8888
* @param mixed $value
8989
* @param mixed $itemtype
9090
* @param integer $itemId
91+
*
9192
* @return array|boolean
9293
*/
9394
public function getMqttMessage($value, $itemtype, $itemId) {

inc/policyfactory.class.php

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public function createFromPolicy(PluginFlyvemdmPolicy $policyData) {
7979
$policy = new PluginFlyvemdmPolicyRemovefile($policyData);
8080
break;
8181

82+
case 'm2m':
83+
$policy = new PluginFlyvemdmPolicyM2m($policyData);
84+
break;
85+
8286
default:
8387
return null;
8488
}

inc/policyinteger.class.php

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function __construct(PluginFlyvemdmPolicy $policy) {
7272
* @param mixed $value
7373
* @param mixed $itemtype
7474
* @param integer $itemId
75+
*
7576
* @return bool
7677
*/
7778
public function integrityCheck($value, $itemtype, $itemId) {

install/policies/mdm.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,21 @@
3636
$category = 'Mobile Device Management';
3737
return [
3838
[
39-
'name' => __('use TLS', 'flyvemdm'),
40-
'symbol' => 'useTLS',
39+
'name' => __('messenging server', 'flyvemdm'),
40+
'symbol' => 'm2m',
4141
'group' => 'MDM',
42-
'type' => 'bool',
42+
'type' => 'm2m',
4343
'type_data' => '',
4444
'unicity' => 1,
4545
'plugin_flyvemdm_policycategories_id' => $category,
46-
'comment' => __('use TLS', 'flyvemdm'),
46+
'comment' => __('messenging server', 'flyvemdm'),
4747
'default_value' => '',
48-
'recommended_value' => '',
48+
'recommended_value' => json_encode(
49+
[
50+
'server' => '',
51+
'port' => '0',
52+
'tls' => '1'
53+
]),
4954
'is_android_policy' => '1',
5055
'is_android_system' => '0',
5156
'is_apple_policy' => '0',

0 commit comments

Comments
 (0)