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

Commit 557674e

Browse files
committed
feat(policy): redesign use TLS policy
Signed-off-by: Thierry Bugier <[email protected]>
1 parent 2a047c8 commit 557674e

File tree

7 files changed

+22
-11
lines changed

7 files changed

+22
-11
lines changed

inc/agent.class.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class PluginFlyvemdmPolicyBase implements PluginFlyvemdmPolicyInterface
6969
protected $specificStatuses = [];
7070

7171
/**
72-
* get common task statuses
72+
* Gets common task statuses
7373
*
7474
* @return array
7575
*/
@@ -90,7 +90,7 @@ public static final function getEnumBaseTaskStatus() {
9090
}
9191

9292
/**
93-
* get specific task statuses
93+
* Gets specific task statuses
9494
* To be overriden in child class
9595
*
9696
* @return array
@@ -117,9 +117,9 @@ public function __construct(PluginFlyvemdmPolicy $policy) {
117117
protected function jsonDecodeProperties($properties, array $defaultProperties) {
118118
if (empty($properties)) {
119119
return $defaultProperties;
120-
} else {
121-
$propertyCollection = json_decode($properties, true);
122120
}
121+
122+
$propertyCollection = json_decode($properties, true);
123123
if (empty($propertyCollection)) {
124124
return $defaultProperties;
125125
}

inc/policydeployapplication.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public function integrityCheck($value, $itemtype, $itemId) {
9191
* @param mixed $value
9292
* @param mixed $itemtype
9393
* @param integer $itemId
94+
*
9495
* @return array|boolean
9596
*/
9697
public function getMqttMessage($value, $itemtype, $itemId) {

inc/policyfactory.class.php

Lines changed: 4 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 10 additions & 5 deletions
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',

tests/src/Flyvemdm/Tests/CommonTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ public static function policyList() {
520520
'Policy/removeFile',
521521
'Policy/disableWifi',
522522
'Policy/disableBluetooth',
523-
'Policy/useTLS',
523+
'Policy/m2m',
524524
'Policy/disableRoaming',
525525
'Policy/disableGPS',
526526
'Policy/disableUsbMtp',

0 commit comments

Comments
 (0)