diff --git a/kandji_processor.php b/kandji_processor.php index edc099b..39abeec 100644 --- a/kandji_processor.php +++ b/kandji_processor.php @@ -23,7 +23,7 @@ public function run($plist) $parser = new CFPropertyList(); $parser->parse($plist, CFPropertyList::FORMAT_XML); $mylist = $parser->toArray(); - + echo "Parsed plist"; // Retrieve Kandji MR record (if existing) try { $model = Kandji_model::select() @@ -33,8 +33,6 @@ public function run($plist) $model = new Kandji_model(); } - $model->fill($mylist); - // Check if we should enable Kandji lookup if (conf('kandji_enable')) { // Load Kandji helper @@ -48,9 +46,9 @@ public function run($plist) $mylist['asset_tag'] = $json[0]->asset_tag; $mylist['blueprint_id'] = $json[0]->blueprint_id; $mylist['blueprint_name'] = $json[0]->blueprint_name; - $mylist['last_check_in'] = $kandji_helper->convert_time_to_epoch($json[0]->last_check_in); - $mylist['last_enrollment'] = $kandji_helper->convert_time_to_epoch($json[0]->last_enrollment); - $mylist['first_enrollment'] = $kandji_helper->convert_time_to_epoch($json[0]->first_enrollment); + $mylist['last_check_in'] = $this->convert_time_to_epoch($json[0]->last_check_in); + $mylist['last_enrollment'] = $this->convert_time_to_epoch($json[0]->last_enrollment); + $mylist['first_enrollment'] = $this->convert_time_to_epoch($json[0]->first_enrollment); // Location section $mylist['realname'] = $json[0]->user->name; @@ -60,4 +58,17 @@ public function run($plist) $model->fill($mylist)->save(); } -} \ No newline at end of file + + /** + * Convert Kandji timestamps to epochs + * + * @return Unix epoch + * @author jc0b + * + **/ + private function convert_time_to_epoch($date) + { + $dt = new \DateTime($date); + return $dt->getTimestamp(); + } +} diff --git a/lib/kandji_helper.php b/lib/kandji_helper.php index 29912b4..4da8173 100755 --- a/lib/kandji_helper.php +++ b/lib/kandji_helper.php @@ -69,18 +69,4 @@ public function send_kandji_query($url) return $return; } - - - /** - * Convert Kandji timestamps to epochs - * - * @return Unix epoch - * @author jc0b - * - **/ - private function convert_time_to_epoch($date) - { - $dt = new \DateTime($date); - return $dt->getTimestamp(); - } } \ No newline at end of file diff --git a/scripts/kandji.py b/scripts/kandji.py index 392d7e0..0f48527 100755 --- a/scripts/kandji.py +++ b/scripts/kandji.py @@ -59,7 +59,7 @@ def main(): result = get_local_kandji_prefs() passport_users = get_passport_info() if len(passport_users) > 0: - result['passport_enabled'] = True + result['passport_enabled'] = "True" result['passport_users'] = passport_users # Write results to cache