diff --git a/.github/actions/composer-tests.sh b/.github/actions/composer-tests.sh new file mode 100755 index 0000000..fafb192 --- /dev/null +++ b/.github/actions/composer-tests.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker exec --user www-data glpi /bin/bash -c "cd /var/www/glpi/plugins/jamf && vendor/bin/phpunit -c tests/phpunit.xml --testsuite \"PHP Unit Tests\" --do-not-cache --verbose" diff --git a/.github/actions/init_containers-start.sh b/.github/actions/init_containers-start.sh new file mode 100755 index 0000000..2762b3b --- /dev/null +++ b/.github/actions/init_containers-start.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e -u -x -o pipefail + +docker-compose pull --quiet +docker-compose up --no-start +docker-compose start + +# Check services health (because the DB container is not ready by the time we try to install GLPI) +for CONTAINER_ID in `docker-compose ps -a -q`; do + CONTAINER_NAME=`/usr/bin/docker inspect --format='{{print .Name}}{{if .Config.Image}} ({{print .Config.Image}}){{end}}' $CONTAINER_ID` + HEALTHY=false + TOTAL_COUNT=0 + until [ $HEALTHY = true ]; do + if [ "`/usr/bin/docker inspect --format='{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{else}}{{print \"healthy\"}}{{end}}' $CONTAINER_ID`" == "healthy" ] + then + HEALTHY=true + echo "$CONTAINER_NAME is healthy" + else + if [ $TOTAL_COUNT -eq 15 ] + then + echo "$CONTAINER_NAME fails to start" + exit 1 + fi + echo "Waiting for $CONTAINER_NAME to be ready..." + sleep 2 + TOTAL_COUNT=$[$TOTAL_COUNT +1] + fi + done +done + +sleep 5 diff --git a/.github/actions/install.sh b/.github/actions/install.sh new file mode 100755 index 0000000..1a40aa8 --- /dev/null +++ b/.github/actions/install.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# install glpi database +docker exec --user www-data glpi /bin/bash -c "cd /var/www/glpi && php bin/console db:install -H db -u glpi -p glpi -d glpi -n -r" + +# install our plugin +docker exec --user www-data glpi /bin/bash -c "cd /var/www/glpi && php bin/console plugin:install -u glpi jamf" +docker exec --user www-data glpi /bin/bash -c "cd /var/www/glpi && php bin/console plugin:activate jamf" diff --git a/.github/actions/phpstan-checks.sh b/.github/actions/phpstan-checks.sh new file mode 100755 index 0000000..ea755f9 --- /dev/null +++ b/.github/actions/phpstan-checks.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker exec --user www-data glpi /bin/bash -c "cd /var/www/glpi/plugins/jamf && vendor/bin/phpstan analyze -c phpstan.neon --memory-limit 256M" diff --git a/.github/actions/teardown_containers-cleanup.sh b/.github/actions/teardown_containers-cleanup.sh new file mode 100755 index 0000000..891c61f --- /dev/null +++ b/.github/actions/teardown_containers-cleanup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker-compose down --volumes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b46b49c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: Jamf Plugin CI +on: + push: + branches: + - "main" + tags: + - 'v*' + pull_request: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: +jobs: + ci: + name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" + strategy: + fail-fast: false + matrix: + include: + - { glpi-version: "10.0.x", php-version: "7.4", db-image: "mariadb:10.5" } + - { glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.5" } + - { glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0" } + uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1" + with: + plugin-key: "jamf" + glpi-version: "${{ matrix.glpi-version }}" + php-version: "${{ matrix.php-version }}" + db-image: "${{ matrix.db-image }}" diff --git a/.gitignore b/.gitignore index 88e99d5..f0dcfe4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vendor -composer.lock \ No newline at end of file +composer.lock +tests/.phpunit.result.cache diff --git a/composer.json b/composer.json index c9ebcf7..3b6170a 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,22 @@ { - "require": { - "php": "^7.4" - }, - "require-dev": { - "glpi-project/tools": "^0.7.2" - }, - "config": { - "optimize-autoloader": true, - "platform": { - "php": "7.4.0" + "require": { + "php": "~7.4.0|~8.0.0|~8.1.0|~8.2.0" }, - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": false + "require-dev": { + "glpi-project/tools": "^0.7.2", + "phpunit/phpunit": "~9.6" + }, + "config": { + "optimize-autoloader": true, + "platform": { + "php": "7.4" + }, + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": false + } + }, + "scripts": { + "test": "phpunit -c phpunit.xml" } - } } diff --git a/inc/api.class.php b/inc/api.class.php index de8d742..2c1b116 100644 --- a/inc/api.class.php +++ b/inc/api.class.php @@ -35,6 +35,8 @@ class PluginJamfAPI */ private static $connection; + protected static $connection_class = PluginJamfConnection::class; + /** * Get data from a JSS Classic API endpoint. * @param string $endpoint The API endpoint. @@ -44,10 +46,10 @@ class PluginJamfAPI * @throws PluginJamfRateLimitException * @since 1.0.0 */ - private static function getClassic(string $endpoint, $raw = false, $response_type = 'application/json') + protected static function getClassic(string $endpoint, $raw = false, $response_type = 'application/json') { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $url = static::$connection->getAPIUrl($endpoint); $client = static::$connection->getClient(); @@ -87,10 +89,10 @@ private static function getClassic(string $endpoint, $raw = false, $response_typ * @return int|bool True if successful, or the HTTP return code if it is not 201. * @since 1.1.0 */ - private static function addClassic(string $endpoint, string $payload) + protected static function addClassic(string $endpoint, string $payload) { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $url = (static::$connection)->getAPIUrl($endpoint); $client = static::$connection->getClient(); @@ -117,10 +119,10 @@ private static function addClassic(string $endpoint, string $payload) * @return int|bool True if successful, or the HTTP return code if it is not 201. * @since 1.1.0 */ - private static function updateClassic(string $endpoint, array $data) + protected static function updateClassic(string $endpoint, array $data) { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $url = (static::$connection)->getAPIUrl($endpoint); $client = static::$connection->getClient(); @@ -147,10 +149,10 @@ private static function updateClassic(string $endpoint, array $data) * @return int|bool True if successful, or the HTTP return code if it is not 200. * @since 1.1.0 */ - private static function deleteClassic(string $endpoint) + protected static function deleteClassic(string $endpoint) { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $url = (static::$connection)->getAPIUrl($endpoint); $client = static::$connection->getClient(); @@ -363,7 +365,7 @@ public static function testProAPIConnection(): bool public static function getJamfProVersion(): string { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $response = static::$connection->getClient()->get(static::$connection->getAPIUrl('v1/jamf-pro-version', true))->getBody()->getContents(); return json_decode($response, true)['version']; @@ -380,8 +382,9 @@ public static function sendMDMCommand(string $payload_xml, bool $user_auth = fal */ public static function getAllMobileDevices() { + var_dump((new Exception())->getTraceAsString());ob_flush(); if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $all_results = []; @@ -419,7 +422,7 @@ public static function getAllMobileDevices() public static function getMobileDeviceByID(int $id, bool $detailed = false) { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $endpoint = "/v2/mobile-devices/{$id}" . ($detailed ? '/detail' : ''); $response = static::$connection->getClient()->get(static::$connection->getAPIUrl($endpoint, true)); @@ -435,7 +438,7 @@ public static function getMobileDeviceByID(int $id, bool $detailed = false) public static function getMobileDeviceByUDID(string $udid, string $section = 'general'): ?array { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $query_params = [ 'section' => strtoupper($section), @@ -457,7 +460,7 @@ public static function getMobileDeviceByUDID(string $udid, string $section = 'ge public static function getAllComputers() { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $all_results = []; @@ -489,7 +492,7 @@ public static function getAllComputers() public static function getComputerByID(int $id, ?string $section = null): ?array { if (!static::$connection) { - static::$connection = new PluginJamfConnection(); + static::$connection = new static::$connection_class(); } $endpoint = "/v1/computer-inventory"; $query_params = [ diff --git a/inc/connection.class.php b/inc/connection.class.php index 8f0a7ff..f73cf9c 100644 --- a/inc/connection.class.php +++ b/inc/connection.class.php @@ -22,6 +22,7 @@ */ use GuzzleHttp\Client; +use GuzzleHttp\ClientTrait; /** * JamfConnection class @@ -33,7 +34,10 @@ class PluginJamfConnection private ?string $bearer_token = null; - private Client $client; + /** + * @var ClientTrait + */ + protected $client; /** * Load connection details from the DB and store them in the $config array. @@ -189,7 +193,10 @@ private function fetchBearerToken() } } - public function getClient(): Client + /** + * @return ClientTrait + */ + public function getClient() { if (!isset($this->client)) { if ($this->bearer_token === null) { @@ -216,7 +223,6 @@ public function getClient(): Client $this->client = new Client($options); } - return $this->client; } } diff --git a/inc/migration.class.php b/inc/migration.class.php index 0079dfe..471c72a 100644 --- a/inc/migration.class.php +++ b/inc/migration.class.php @@ -40,6 +40,9 @@ final class PluginJamfMigration */ private $db; + /** @var PluginJamfAPI */ + private $api; + /** * PluginJamfMigration constructor. * @param string $version @@ -307,7 +310,7 @@ private function apply_1_1_0_migration() // Find all devices that don't have the jamf id recorded, and retrieve it. $unassigned = $mobiledevice->find(['jamf_items_id' => -1]); foreach ($unassigned as $item) { - $jamf_item = PluginJamfAPI::getMobileDeviceByUDID($item['udid']); + $jamf_item = $this->api::getMobileDeviceByUDID($item['udid']); if ($jamf_item !== null && count($jamf_item) === 1) { $mobiledevice->update([ 'id' => $item['id'], @@ -552,7 +555,11 @@ public function apply_3_0_0_migration(): void 'FROM' => 'glpi_plugin_jamf_devices' ]); - $jss_mobiledevices = PluginJamfAPI::getAllMobileDevices(); + if (count($devices)) { + $jss_mobiledevices = $this->api::getAllMobileDevices(); + } else { + $jss_mobiledevices = []; + } foreach ($devices as $device) { if ($device['jamf_type'] === 'MobileDevice') { // We can get the model identifier directly from the list of mobile devices @@ -572,7 +579,7 @@ public function apply_3_0_0_migration(): void } } else if ($device['jamf_type'] === 'Computer') { // We need to query the JSS for the computer's model identifier - $computer = PluginJamfAPI::getComputerByID($device['jamf_items_id'], 'hardware'); + $computer = $this->api::getComputerByID($device['jamf_items_id'], 'hardware'); if ($computer !== null) { $this->db->update( 'glpi_plugin_jamf_devices', diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..cd23ec3 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,6 @@ + + + + ./tests/units/ + + diff --git a/tests/AbstractDBTest.php b/tests/AbstractDBTest.php new file mode 100644 index 0000000..318ffb5 --- /dev/null +++ b/tests/AbstractDBTest.php @@ -0,0 +1,343 @@ +. + * + * --------------------------------------------------------------------- + */ + +use PHPUnit\Framework\TestCase; +use Glpi\Tests\Log\TestHandler; +use Glpi\Toolbox\Sanitizer; +use Psr\Log\LogLevel; + +class AbstractDBTest extends TestCase +{ + private int $int; + + private string $str; + + /** + * @var TestHandler + */ + private static TestHandler $php_log_handler; + + /** + * @var TestHandler + */ + private static TestHandler $sql_log_handler; + + public static function setUpBeforeClass(): void + { + global $DB; + $DB->beginTransaction(); + static::resetSession(); + + // Ensure cache is clear + global $GLPI_CACHE; + $GLPI_CACHE->clear(); + + // Init log handlers + global $PHPLOGGER, $SQLLOGGER; + /** @var Monolog\Logger $PHPLOGGER */ + static::$php_log_handler = new TestHandler(LogLevel::DEBUG); + $PHPLOGGER->setHandlers([static::$php_log_handler]); + static::$sql_log_handler = new TestHandler(LogLevel::DEBUG); + $SQLLOGGER->setHandlers([static::$sql_log_handler]); + + $default_config = [ + 'autoimport' => 0, + 'sync_general' => 1, + 'sync_components' => 1, + 'sync_financial' => 1, + 'sync_os' => 1, + 'sync_software' => 1, + 'sync_user' => 1, + 'computer_type' => 0, + 'ipad_type' => 0, + 'iphone_type' => 0, + 'appletv_type' => 0, + 'default_manufacturer' => 0, + ]; + foreach ($default_config as $name => $value) { + $DB->updateOrInsert('glpi_configs', [ + 'value' => $value, + 'context' => 'plugin:Jamf', + 'name' => $name, + ], [ + 'context' => 'plugin:Jamf', + 'name' => $name, + ]); + } + } + + public static function tearDownAfterClass(): void + { + global $DB; + $DB->rollback(); + } + + protected static function resetSession() + { + Session::destroy(); + Session::start(); + + $_SESSION['glpi_use_mode'] = Session::NORMAL_MODE; + $_SESSION['glpiactive_entity'] = 0; + + global $CFG_GLPI; + foreach ($CFG_GLPI['user_pref_field'] as $field) { + if (!isset($_SESSION["glpi$field"]) && isset($CFG_GLPI[$field])) { + $_SESSION["glpi$field"] = $CFG_GLPI[$field]; + } + } + } + + /** + * Get a unique random string + */ + protected function getUniqueString() + { + if (is_null($this->str)) { + return $this->str = uniqid('str', false); + } + return $this->str .= 'x'; + } + + /** + * Get a unique random integer + */ + protected function getUniqueInteger() + { + if (is_null($this->int)) { + return $this->int = random_int(1000, 10000); + } + return $this->int++; + } + + /** + * Connect (using the test user per default) + * + * @param string $user_name User name (defaults to TU_USER) + * @param string $user_pass user password (defaults to TU_PASS) + * @param bool $noauto disable autologin (from CAS by example) + * @param bool $expected bool result expected from login return + * + * @return \Auth + */ + protected function login( + string $user_name = TU_USER, + string $user_pass = TU_PASS, + bool $noauto = true, + bool $expected = true + ): \Auth { + \Session::destroy(); + \Session::start(); + + $auth = new Auth(); + $this->assertEquals($expected, $auth->login($user_name, $user_pass, $noauto)); + + return $auth; + } + + /** + * Log out current user + * + * @return void + */ + protected function logOut() + { + $ctime = $_SESSION['glpi_currenttime']; + \Session::destroy(); + $_SESSION['glpi_currenttime'] = $ctime; + } + + /** + * change current entity + * + * @param int|string $entityname Name of the entity (or its id) + * @param boolean $subtree Recursive load + * + * @return void + */ + protected function setEntity($entityname, $subtree) + { + $entity_id = is_int($entityname) ? $entityname : getItemByTypeName('Entity', $entityname, true); + $res = Session::changeActiveEntities($entity_id, $subtree); + $this->assertTrue($res); + } + + /** + * Generic method to test if an added object is corretly inserted + * + * @param CommonDBTM $object The object to test + * @param int $id The id of added object + * @param array $input the input used for add object (optionnal) + * + * @return void + */ + protected function checkInput(CommonDBTM $object, $id = 0, $input = []) + { + $input = Sanitizer::dbUnescapeRecursive($input); // slashes in input should not be stored in DB + + $this->assertGreaterThan(0, $id, 'ID is not valid'); + $this->assertTrue($object->getFromDB($id), 'Object not found in DB'); + $this->assertEquals($id, $object->getID(), 'Object could not be loaded'); + + if (count($input)) { + foreach ($input as $k => $v) { + $this->assertEquals($v, $object->fields[$k], " + '$k' key current value '{$object->fields[$k]}' (" . gettype($object->fields[$k]) . ") + is not equal to '$v' (" . gettype($v) . ")"); + } + } + } + + /** + * Get all classes in folder inc/ + * + * @param boolean $function Whether to look for a function + * @param array $excludes List of classes to exclude + * + * @return array + */ + protected function getClasses($function = false, array $excludes = []) + { + // Add deprecated classes to excludes to prevent test failure + $excludes = array_merge( + $excludes, + [ + 'TicketFollowup', // Deprecated + '/^RuleImportComputer.*/', // Deprecated + ] + ); + + $files_iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator(GLPI_ROOT . '/src'), + RecursiveIteratorIterator::SELF_FIRST + ); + + $classes = []; + foreach ($files_iterator as $fileInfo) { + if ($fileInfo->getExtension() !== 'php') { + continue; + } + + $classname = $fileInfo->getBasename('.php'); + + $is_excluded = false; + foreach ($excludes as $exclude) { + if ($classname === $exclude || @preg_match($exclude, $classname) === 1) { + $is_excluded = true; + break; + } + } + if ($is_excluded) { + continue; + } + + if (!class_exists($classname)) { + continue; + } + $reflectionClass = new ReflectionClass($classname); + if ($reflectionClass->isAbstract()) { + continue; + } + + if ($function) { + if (method_exists($classname, $function)) { + $classes[] = $classname; + } + } else { + $classes[] = $classname; + } + } + return array_unique($classes); + } + + /** + * Create an item of the given class + * + * @param string $itemtype + * @param array $input + * @param array $skip_fields Fields that wont be checked after creation + * + * @return CommonDBTM + */ + protected function createItem($itemtype, $input, $skip_fields = []): CommonDBTM + { + $item = new $itemtype(); + $input = Sanitizer::sanitize($input); + $id = $item->add($input); + $this->assertGreaterThan(0, $id, 'ID is not valid'); + + // Remove special fields + $input = array_filter($input, static function ($key) use ($skip_fields) { + return !in_array($key, $skip_fields, true) && !str_starts_with($key, '_'); + }, ARRAY_FILTER_USE_KEY); + + $this->checkInput($item, $id, $input); + + return $item; + } + + /** + * Create an item of the given class + * + * @param string $itemtype + * @param array $input + */ + protected function updateItem($itemtype, $id, $input) + { + $item = new $itemtype(); + $input['id'] = $id; + $input = Sanitizer::sanitize($input); + $success = $item->update($input); + $this->assertTrue($success); + + // Remove special fields + $input = array_filter($input, static fn ($key) => !str_starts_with($key, '_'), ARRAY_FILTER_USE_KEY); + + $this->checkInput($item, $id, $input); + } + + /** + * Create multiples items of the given class + * + * @param string $itemtype + * @param array $inputs + */ + protected function createItems($itemtype, $inputs) + { + foreach ($inputs as $input) { + $this->createItem($itemtype, $input); + } + } +} diff --git a/tests/apitest.class.php b/tests/apitest.class.php index 1b18c9d..56981c2 100644 --- a/tests/apitest.class.php +++ b/tests/apitest.class.php @@ -23,47 +23,5 @@ class PluginJamfApiTest extends PluginJamfAPI { - /** - * Convert a standard Classic API endpoint to filename which points to an appropriate sample response file. - * - * This does not guarantee that the file actually exists. - * @param string $endpoint The Classic API endpoint - * @param string $response_type The content type expected for the response - * @return string The name of the expected sample response file - * @since 2.0.0 - */ - private static function endpointToFilename(string $endpoint, $response_type): string { - $response_ext = $response_type === 'application/xml' ? 'xml' : 'json'; - return GLPI_ROOT . '/plugins/jamf/tools/samples/classic_api/' . $endpoint . '.' . $response_ext; - } - - protected static function getClassic(string $endpoint, $raw = false, $response_type = 'application/json') { - $file = self::endpointToFilename($endpoint, $response_type); - if (!file_exists($file)) { - return null; - } - $handle = fopen($file, 'rb'); - $response = fread($handle, filesize($file)); - fclose($handle); - - if ($response_type === 'application/xml') { - return simplexml_load_string($response); - } - return json_decode($response, true); - } - - protected static function addClassic(string $endpoint, string $payload) { - // No-Op - return true; - } - - protected static function updateClassic(string $endpoint, array $data) { - // No-Op - return true; - } - - protected static function deleteClassic(string $endpoint) { - // No-Op - return true; - } + protected static $connection_class = PluginJamfConnectionTest::class; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2dc0312..fc7dc6f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,14 +2,17 @@ global $CFG_GLPI; define('GLPI_ROOT', dirname(dirname(dirname(__DIR__)))); -define("GLPI_CONFIG_DIR", GLPI_ROOT . "/tests"); +if (file_exists("vendor/autoload.php")) { + require_once "vendor/autoload.php"; +} include GLPI_ROOT . "/inc/includes.php"; -include_once GLPI_ROOT . '/tests/GLPITestCase.php'; -include_once GLPI_ROOT . '/tests/DbTestCase.php'; +//include_once GLPI_ROOT . '/tests/GLPITestCase.php'; +//include_once GLPI_ROOT . '/tests/DbTestCase.php'; +include_once "AbstractDBTest.php"; $plugin = new Plugin(); -$plugin->checkStates(true); +$plugin->checkPluginState('jamf'); $plugin->getFromDBbyDir('jamf'); if (!plugin_jamf_check_prerequisites()) { @@ -24,6 +27,7 @@ $plugin->activate($plugin->getID()); } -include_once __DIR__ . '/apitestclassic.class.php'; -include_once __DIR__ . '/mobiletestsync.class.php'; -include_once __DIR__ . '/computertestsync.class.php'; +include_once 'apitest.class.php'; +include_once 'connectiontest.class.php'; +include_once 'mobiletestsync.class.php'; +include_once 'computertestsync.class.php'; diff --git a/tests/computertestsync.class.php b/tests/computertestsync.class.php index df1af84..11e6fef 100644 --- a/tests/computertestsync.class.php +++ b/tests/computertestsync.class.php @@ -23,7 +23,7 @@ class PluginJamfComputerTestSync extends PluginJamfComputerSync { - protected static $api = PluginJamfApiTestClassic::class; + protected static $api = PluginJamfApiTest::class; public static function sync(string $itemtype, int $items_id, bool $use_transaction = true): bool { return parent::sync($itemtype, $items_id, false); diff --git a/tests/connectiontest.class.php b/tests/connectiontest.class.php new file mode 100644 index 0000000..db8b095 --- /dev/null +++ b/tests/connectiontest.class.php @@ -0,0 +1,76 @@ +. + * + * --------------------------------------------------------------------- + */ + +use GuzzleHttp\ClientTrait; +use Psr\Http\Client\ClientInterface; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; + +class PluginJamfConnectionTest extends PluginJamfConnection +{ + public function getClient(): ClientInterface + { + if (!isset($this->client)) { + $this->client = new class implements ClientInterface { + use ClientTrait; + + public function sendRequest(RequestInterface $request): ResponseInterface + { + $endpoint = $request->getUri()->getPath(); + var_dump($endpoint); + // remove query parameters + $endpoint = str_contains($endpoint, '?') ? explode('?', $endpoint)[0] : $endpoint; + $response_type = $request->getHeader('Accept')[0] ?? 'application/json'; + $response_ext = $response_type === 'application/xml' ? 'xml' : 'json'; + $mock_file_path = GLPI_ROOT . '/plugins/jamf/tools/samples/' . $endpoint . '.' . $response_ext; + return new \GuzzleHttp\Psr7\Response(200, [], file_get_contents($mock_file_path)); + } + + public function request(string $method, $uri, array $options = []): ResponseInterface + { + $request = new \GuzzleHttp\Psr7\Request($method, $uri, $options['headers'] ?? []); + return $this->sendRequest($request); + } + + public function requestAsync(string $method, $uri, array $options = []): \GuzzleHttp\Promise\PromiseInterface + { + return \GuzzleHttp\Promise\Create::promiseFor($this->request($method, $uri, $options)); + } + }; + } + + return $this->client; + } +} diff --git a/tests/mobiletestsync.class.php b/tests/mobiletestsync.class.php index b49e164..df2fcef 100644 --- a/tests/mobiletestsync.class.php +++ b/tests/mobiletestsync.class.php @@ -23,7 +23,7 @@ class PluginJamfMobileTestSync extends PluginJamfMobileSync { - protected static $api = PluginJamfApiTestClassic::class; + protected static $api = PluginJamfApiTest::class; public static function sync(string $itemtype, int $items_id, bool $use_transaction = true): bool { return parent::sync($itemtype, $items_id, false); diff --git a/tests/units/PluginJamfComputerSync.php b/tests/units/PluginJamfComputerSync.php index 6435052..bccfbfd 100644 --- a/tests/units/PluginJamfComputerSync.php +++ b/tests/units/PluginJamfComputerSync.php @@ -30,7 +30,7 @@ use PluginJamfImport; use PluginJamfItem_ExtensionAttribute; -class PluginJamfComputerSync extends DbTestCase { +class PluginJamfComputerSync extends \AbstractDBTest { public function testDiscover() { global $DB; @@ -40,7 +40,7 @@ public function testDiscover() { $iterator = $DB->request([ 'FROM' => PluginJamfImport::getTable() ]); - $this->integer($iterator->count())->isEqualTo(5); + $this->assertEquals(5, $iterator->count()); } public function testSyncExtensionAttributeDefinitions() { @@ -54,7 +54,7 @@ public function testSyncExtensionAttributeDefinitions() { 'jamf_type' => 'Computer' ] ]); - $this->integer($iterator->count())->isEqualTo(4); + $this->assertEquals(1, $iterator->count()); // Make sure syncing again does not cause duplicates PluginJamfComputerTestSync::syncExtensionAttributeDefinitions(); @@ -65,7 +65,7 @@ public function testSyncExtensionAttributeDefinitions() { 'jamf_type' => 'Computer' ] ]); - $this->integer($iterator->count())->isEqualTo(4); + $this->assertEquals(1, $iterator->count()); } public function testImport() { @@ -73,38 +73,46 @@ public function testImport() { PluginJamfComputerTestSync::syncExtensionAttributeDefinitions(); - PluginJamfComputerTestSync::import('Computer', 33, false); + PluginJamfComputerTestSync::import('Computer', 1, false); // Make sure the computer was created $iterator = $DB->request([ 'FROM' => \Computer::getTable(), 'WHERE' => [ - 'name' => 'Computer 2' + 'name' => 'CConardMBA' ] ]); - $this->integer($iterator->count())->isEqualTo(1); - $item = $iterator->next(); + $this->assertEquals(1, $iterator->count()); + $item = $iterator->current(); // Make sure the new computer is linked properly $link_iterator = $DB->request([ - //'SELECT' => ['id', 'udid'], - 'FROM' => PluginJamfComputer::getTable(), + 'SELECT' => [PluginJamfComputer::getTable() . '.id', 'udid'], + 'FROM' => 'glpi_plugin_jamf_devices', + 'LEFT JOIN' => [ + PluginJamfComputer::getTable() => [ + 'ON' => [ + PluginJamfComputer::getTable() => 'glpi_plugin_jamf_devices_id', + 'glpi_plugin_jamf_devices' => 'id' + ] + ] + ], 'WHERE' => [ 'itemtype' => 'Computer', 'items_id' => $item['id'] ] ]); - $this->integer($link_iterator->count())->isEqualTo(1); - $link = $link_iterator->next(); - $this->string($link['udid'])->isEqualTo('CA40DA58-60A3-11E4-90B8-12DF261F2C7E'); + $this->assertEquals(1, $link_iterator->count()); + $link = $link_iterator->current(); + $this->assertEquals('55900BDC-347C-58B1-D249-F32244B11D30', $link['udid']); $ext_attr_iterator = $DB->request([ 'FROM' => PluginJamfItem_ExtensionAttribute::getTable(), 'WHERE' => [ - 'itemtype' => PluginJamfComputer::class, + 'itemtype' => 'PluginJamfComputer', 'items_id' => $link['id'] ] ]); - $this->integer($ext_attr_iterator->count())->isEqualTo(4); + $this->assertEquals(1, $ext_attr_iterator->count()); } } diff --git a/tests/units/PluginJamfMobileSync.php b/tests/units/PluginJamfMobileSync.php index c01ec01..278e363 100644 --- a/tests/units/PluginJamfMobileSync.php +++ b/tests/units/PluginJamfMobileSync.php @@ -35,7 +35,7 @@ use PluginJamfSync; use ReflectionClass; -class PluginJamfMobileSync extends DbTestCase { +class PluginJamfMobileSync extends \AbstractDBTest { public function testDiscover() { global $DB; @@ -46,7 +46,7 @@ public function testDiscover() { 'FROM' => PluginJamfImport::getTable() ]); - $this->integer($iterator->count())->isEqualTo(5); + $this->assertEquals(6, $iterator->count()); } public function testSyncExtensionAttributeDefinitions() { @@ -60,7 +60,7 @@ public function testSyncExtensionAttributeDefinitions() { 'jamf_type' => 'MobileDevice' ] ]); - $this->integer($iterator->count())->isEqualTo(2); + $this->assertEquals(1, $iterator->count()); // Make sure syncing again does not cause duplicates PluginJamfMobileTestSync::syncExtensionAttributeDefinitions(); @@ -71,7 +71,7 @@ public function testSyncExtensionAttributeDefinitions() { 'jamf_type' => 'MobileDevice' ] ]); - $this->integer($iterator->count())->isEqualTo(2); + $this->assertEquals(1, $iterator->count()); } public function testImportAsComputer() { @@ -80,33 +80,42 @@ public function testImportAsComputer() { // Force sync extension attribute definitions PluginJamfMobileTestSync::syncExtensionAttributeDefinitions(); - PluginJamfMobileTestSync::import('Computer', 28, false); + PluginJamfMobileTestSync::import('Computer', 5, false); // Make sure the computer was created $iterator = $DB->request([ 'FROM' => \Computer::getTable(), 'WHERE' => [ - 'name' => 'Device 2' + 'name' => 'Test iPad 3' ] ]); - $this->integer($iterator->count())->isEqualTo(1); - $item = $iterator->next(); + $this->assertEquals(1, $iterator->count()); + $item = $iterator->current(); // Make sure the new computer is linked properly $link_iterator = $DB->request([ - 'FROM' => PluginJamfMobileDevice::getTable(), + 'SELECT' => ['id', 'udid', 'managed', 'supervised', 'activation_lock_enabled', 'lost_mode_enabled'], + 'FROM' => 'glpi_plugin_jamf_devices', + 'LEFT JOIN' => [ + PluginJamfMobileDevice::getTable() => [ + 'ON' => [ + PluginJamfMobileDevice::getTable() => 'id', + 'glpi_plugin_jamf_devices' => 'jamf_items_id' + ] + ] + ], 'WHERE' => [ 'itemtype' => 'Computer', 'items_id' => $item['id'] ] ]); - $this->integer($link_iterator->count())->isEqualTo(1); - $link = $link_iterator->next(); - $this->string($link['udid'])->isEqualTo('ca44c88e60a311e490b812df261f2c7e'); - $this->integer($link['managed'])->isEqualTo(1); - $this->integer($link['supervised'])->isEqualTo(0); - $this->integer($link['activation_lock_enabled'])->isEqualTo(1); - $this->string($link['lost_mode_enabled'])->isEqualTo('Unsupervised Device'); + $this->assertEquals(1, $link_iterator->count()); + $link = $link_iterator->current(); + $this->assertEquals('1aec6610a9401d2cc47cb55e1a2f7b500ab75864', $link['udid']); + $this->assertEquals(1, $link['managed']); + $this->assertEquals(1, $link['supervised']); + $this->assertEquals(0, $link['activation_lock_enabled']); + $this->assertEquals(null, $link['lost_mode_enabled']); $ext_attr_iterator = $DB->request([ 'FROM' => PluginJamfItem_ExtensionAttribute::getTable(), @@ -115,34 +124,42 @@ public function testImportAsComputer() { 'items_id' => $link['id'] ] ]); - $this->integer($ext_attr_iterator->count())->isEqualTo(1); + $this->assertEquals(1, $ext_attr_iterator->count()); } public function testImportAsPhone() { global $DB; - PluginJamfMobileTestSync::import('Phone', 28, false); + PluginJamfMobileTestSync::import('Phone', 5, false); // Make sure the phone was created $iterator = $DB->request([ 'FROM' => Phone::getTable(), 'WHERE' => [ - 'name' => 'Device 2' + 'name' => 'Test iPad 3' ] ]); - $this->integer($iterator->count())->isEqualTo(1); - $item = $iterator->next(); + $this->assertEquals(1, $iterator->count()); + $item = $iterator->current(); // Make sure the new phone is linked properly $link_iterator = $DB->request([ - 'FROM' => PluginJamfMobileDevice::getTable(), + 'FROM' => 'glpi_plugin_jamf_devices', + 'LEFT JOIN' => [ + PluginJamfMobileDevice::getTable() => [ + 'ON' => [ + PluginJamfMobileDevice::getTable() => 'id', + 'glpi_plugin_jamf_devices' => 'jamf_items_id' + ] + ] + ], 'WHERE' => [ 'itemtype' => 'Phone', 'items_id' => $item['id'] ] ]); - $this->integer($link_iterator->count())->isEqualTo(1); - $link = $link_iterator->next(); - $this->integer($link['jamf_items_id'])->isEqualTo(28); + $this->assertEquals(1, $link_iterator->count()); + $link = $link_iterator->current(); + $this->assertEquals(5, $link['jamf_items_id']); $ext_iterator = $DB->request([ 'FROM' => PluginJamfExtField::getTable(), @@ -152,9 +169,9 @@ public function testImportAsPhone() { 'name' => 'uuid' ] ]); - $this->integer($ext_iterator->count())->isEqualTo(1); - $ext_field = $ext_iterator->next(); - $this->string($ext_field['value'])->isEqualTo('ca44c88e60a311e490b812df261f2c7e'); + $this->assertEquals(1, $ext_iterator->count()); + $ext_field = $ext_iterator->current(); + $this->assertEquals('1aec6610a9401d2cc47cb55e1a2f7b500ab75864', $ext_field['value']); } public function deviceSyncEnginesProvider() { @@ -174,8 +191,8 @@ public function deviceSyncEnginesProvider() { */ public function testGetDeviceSyncEngineItem($device_class, $sync_class) { $rdc = new ReflectionClass($device_class); - $this->boolean($rdc->getParentClass()->getName() === PluginJamfAbstractDevice::class)->isTrue(); + $this->assertSame($rdc->getParentClass()->getName(), PluginJamfAbstractDevice::class); $rsc = new ReflectionClass($sync_class); - $this->boolean($rsc->isSubclassOf(PluginJamfSync::class))->isTrue(); + $this->assertTrue($rsc->isSubclassOf(PluginJamfSync::class)); } } diff --git a/tools/samples/classic_api/accounts.xml b/tools/samples/JSSResource/accounts.xml similarity index 100% rename from tools/samples/classic_api/accounts.xml rename to tools/samples/JSSResource/accounts.xml diff --git a/tools/samples/classic_api/accounts/userid/1.xml b/tools/samples/JSSResource/accounts/userid/1.xml similarity index 100% rename from tools/samples/classic_api/accounts/userid/1.xml rename to tools/samples/JSSResource/accounts/userid/1.xml diff --git a/tools/samples/classic_api/accounts/userid/2.xml b/tools/samples/JSSResource/accounts/userid/2.xml similarity index 100% rename from tools/samples/classic_api/accounts/userid/2.xml rename to tools/samples/JSSResource/accounts/userid/2.xml diff --git a/tools/samples/JSSResource/computerextensionattributes.json b/tools/samples/JSSResource/computerextensionattributes.json new file mode 100644 index 0000000..1fc2e44 --- /dev/null +++ b/tools/samples/JSSResource/computerextensionattributes.json @@ -0,0 +1,9 @@ +{ + "computer_extension_attributes": [ + { + "id": 1, + "name": "Get Application's Developer Name", + "enabled": true + } + ] +} diff --git a/tools/samples/JSSResource/computerextensionattributes/id/1.json b/tools/samples/JSSResource/computerextensionattributes/id/1.json new file mode 100644 index 0000000..9bce170 --- /dev/null +++ b/tools/samples/JSSResource/computerextensionattributes/id/1.json @@ -0,0 +1,13 @@ +{ + "computer_extension_attribute": { + "id": 1, + "name": "TestExtField", + "enabled": true, + "description": "", + "data_type": "String", + "input_type": { + "type": "Text Field" + }, + "inventory_display": "General" + } +} diff --git a/tools/samples/JSSResource/computers/id/1.json b/tools/samples/JSSResource/computers/id/1.json new file mode 100644 index 0000000..491e4fe --- /dev/null +++ b/tools/samples/JSSResource/computers/id/1.json @@ -0,0 +1,243 @@ +{ + "computer": { + "general": { + "id": 1, + "name": "CConardMBA", + "network_adapter_type": "", + "mac_address": "", + "alt_network_adapter_type": "", + "alt_mac_address": "", + "ip_address": "", + "last_reported_ip": "", + "serial_number": "C02Q7KHTGFWF", + "udid": "55900BDC-347C-58B1-D249-F32244B11D30", + "jamf_version": "", + "platform": "Mac", + "barcode_1": "", + "barcode_2": "", + "asset_tag": "", + "remote_management": { + "managed": false, + "management_username": "deprecated", + "management_password_sha256": "deprecated" + }, + "supervised": false, + "mdm_capable": false, + "mdm_capable_users": {}, + "report_date": "2020-08-21 00:22:01", + "report_date_epoch": 1597969321824, + "report_date_utc": "2020-08-21T00:22:01.824+0000", + "last_contact_time": "", + "last_contact_time_epoch": 0, + "last_contact_time_utc": "", + "initial_entry_date": "2020-06-12", + "initial_entry_date_epoch": 1591998456927, + "initial_entry_date_utc": "2020-06-12T21:47:36.927+0000", + "last_cloud_backup_date_epoch": 0, + "last_cloud_backup_date_utc": "", + "last_enrolled_date_epoch": 0, + "last_enrolled_date_utc": "", + "mdm_profile_expiration_epoch": 0, + "mdm_profile_expiration_utc": "", + "distribution_point": "", + "sus": "", + "site": { + "id": -1, + "name": "None" + }, + "itunes_store_account_is_active": false + }, + "location": { + "username": "", + "realname": "", + "real_name": "", + "email_address": "", + "position": "", + "phone": "", + "phone_number": "", + "department": "", + "building": "", + "room": "" + }, + "purchasing": { + "is_purchased": true, + "is_leased": false, + "po_number": "", + "vendor": "", + "applecare_id": "", + "purchase_price": "", + "purchasing_account": "", + "po_date": "", + "po_date_epoch": 0, + "po_date_utc": "", + "warranty_expires": "", + "warranty_expires_epoch": 0, + "warranty_expires_utc": "", + "lease_expires": "", + "lease_expires_epoch": 0, + "lease_expires_utc": "", + "life_expectancy": 0, + "purchasing_contact": "", + "os_applecare_id": "", + "os_maintenance_expires": "", + "attachments": [] + }, + "peripherals": [], + "hardware": { + "make": "", + "model": "", + "model_identifier": "", + "os_name": "", + "os_version": "", + "os_build": "", + "software_update_device_id": "", + "active_directory_status": "", + "service_pack": "", + "processor_type": "", + "is_apple_silicon": false, + "processor_architecture": "", + "processor_speed": -1, + "processor_speed_mhz": -1, + "number_processors": -1, + "number_cores": -1, + "total_ram": -1, + "total_ram_mb": -1, + "boot_rom": "", + "bus_speed": -1, + "bus_speed_mhz": -1, + "battery_capacity": 0, + "cache_size": 0, + "cache_size_kb": 0, + "available_ram_slots": 0, + "optical_drive": "", + "nic_speed": "", + "smc_version": "", + "ble_capable": false, + "supports_ios_app_installs": false, + "sip_status": "Not collected", + "gatekeeper_status": "Not collected", + "xprotect_version": "", + "institutional_recovery_key": "Not Present", + "disk_encryption_configuration": "", + "filevault2_users": [], + "storage": [ + { + "disk": "disk0", + "model": "M4-CT256M4SSD2", + "revision": "040H", + "serial_number": "000000001307092B4094", + "size": 262205, + "drive_capacity_mb": 262205, + "connection_type": "NO", + "smart_status": "Verified", + "partitions": [ + { + "name": "Mac (Boot Partition)", + "size": 242281, + "type": "boot", + "partition_capacity_mb": 242281, + "percentage_full": 74, + "available_mb": 179288, + "filevault_status": "Encrypted", + "filevault_percent": 100, + "filevault2_status": "Encrypted", + "filevault2_percent": 100, + "boot_drive_available_mb": 179288, + "lvgUUID": "0DDE4907-633D-4CE7-BA6B-4790018C4A77", + "lvUUID": "77FF93E0-F314-49C8-BA18-DE39A77476AE", + "pvUUID": "08634549-605F-4874-814A-2E6777336A58" + } + ] + }, + { + "disk": "disk1", + "model": "Hitachi HTS725050A9A364", + "revision": "PC4OC70E", + "serial_number": "100726PCK400VLJUKA4J", + "size": 512113, + "drive_capacity_mb": 512113, + "connection_type": "NO", + "smart_status": "Verified", + "partitions": [ + { + "name": "Macintosh HD", + "size": 476120, + "type": "other", + "partition_capacity_mb": 476120, + "percentage_full": 88, + "available_mb": 418986, + "filevault_status": "Encrypted", + "filevault_percent": 100, + "filevault2_status": "Encrypted", + "filevault2_percent": 100 + } + ] + }, + { + "disk": "disk3", + "model": "", + "revision": "", + "serial_number": "", + "size": 731, + "drive_capacity_mb": 731, + "connection_type": "", + "smart_status": "", + "partitions": [ + { + "name": "Parallels Desktop 10 (Boot Partition)", + "size": 731, + "type": "other", + "partition_capacity_mb": 731, + "percentage_full": 77, + "available_mb": 563, + "filevault_status": "Encrypted", + "filevault_percent": 100, + "filevault2_status": "Encrypted", + "filevault2_percent": 100 + } + ] + } + ], + "mapped_printers": [] + }, + "certificates": [], + "security": { + "activation_lock": false, + "recovery_lock_enabled": false, + "secure_boot_level": "unknown", + "external_boot_level": "unknown", + "firewall_enabled": false + }, + "software": { + "unix_executables": [], + "licensed_software": [], + "installed_by_casper": [], + "installed_by_installer_swu": [], + "cached_by_casper": [], + "available_software_updates": [], + "available_updates": [], + "running_services": [], + "applications": [], + "fonts": [], + "plugins": [] + }, + "extension_attributes": [ + { + "id": 1, + "name": "TestExtField", + "type": "String", + "multi_value": false, + "value": "TestExtFieldValue" + } + ], + "groups_accounts": { + "computer_group_memberships": [], + "local_accounts": [], + "user_inventories": { + "disable_automatic_login": true + } + }, + "iphones": [], + "configuration_profiles": [] + } +} diff --git a/tools/samples/JSSResource/computers/id/1.xml b/tools/samples/JSSResource/computers/id/1.xml new file mode 100644 index 0000000..3e663f4 --- /dev/null +++ b/tools/samples/JSSResource/computers/id/1.xml @@ -0,0 +1,254 @@ + + + + 1 + CConardMBA + + + + + + + C02Q7KHTGFWF + 55900BDC-347C-58B1-D249-F32244B11D30 + + Mac + + + + + false + deprecated + deprecated + + false + false + + 2020-08-21 00:22:01 + 1597969321824 + 2020-08-21T00:22:01.824+0000 + + 0 + + 2020-06-12 + 1591998456927 + 2020-06-12T21:47:36.927+0000 + 0 + + 0 + + 0 + + + + + -1 + None + + false + + + + + + + + + + + + + + + true + false + + + + + + + 0 + + + 0 + + + 0 + + 0 + + + + + + + 0 + + + + + + + + + + + + + false + + -1 + -1 + -1 + -1 + -1 + -1 + + -1 + -1 + 0 + 0 + 0 + 0 + + + + false + false + Not collected + Not collected + + Not Present + + + + + disk0 + M4-CT256M4SSD2 + 040H + 000000001307092B4094 + 262205 + 262205 + NO + Verified + + + Mac (Boot Partition) + 242281 + boot + 242281 + 74 + 179288 + Encrypted + 100 + Encrypted + 100 + 179288 + 0DDE4907-633D-4CE7-BA6B-4790018C4A77 + 77FF93E0-F314-49C8-BA18-DE39A77476AE + 08634549-605F-4874-814A-2E6777336A58 + + + + + disk1 + Hitachi HTS725050A9A364 + PC4OC70E + 100726PCK400VLJUKA4J + 512113 + 512113 + NO + Verified + + + Macintosh HD + 476120 + other + 476120 + 88 + 418986 + Encrypted + 100 + Encrypted + 100 + + + + + disk3 + + + + 731 + 731 + + + + + Parallels Desktop 10 (Boot Partition) + 731 + other + 731 + 77 + 563 + Encrypted + 100 + Encrypted + 100 + + + + + + + + + false + false + unknown + unknown + false + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + 1 + TestExtField + String + false + TestExtFieldValue + + + + + + + true + + + + 0 + + + 0 + + diff --git a/tools/samples/classic_api/computers/subset/basic.json b/tools/samples/JSSResource/computers/subset/basic.json similarity index 100% rename from tools/samples/classic_api/computers/subset/basic.json rename to tools/samples/JSSResource/computers/subset/basic.json diff --git a/tools/samples/classic_api/computers/subset/basic.xml b/tools/samples/JSSResource/computers/subset/basic.xml similarity index 100% rename from tools/samples/classic_api/computers/subset/basic.xml rename to tools/samples/JSSResource/computers/subset/basic.xml diff --git a/tools/samples/JSSResource/mobiledeviceextensionattributes.json b/tools/samples/JSSResource/mobiledeviceextensionattributes.json new file mode 100644 index 0000000..4e6fb3f --- /dev/null +++ b/tools/samples/JSSResource/mobiledeviceextensionattributes.json @@ -0,0 +1,8 @@ +{ + "mobile_device_extension_attributes": [ + { + "id": 1, + "name": "Staff Device" + } + ] +} diff --git a/tools/samples/JSSResource/mobiledeviceextensionattributes/id/1.json b/tools/samples/JSSResource/mobiledeviceextensionattributes/id/1.json new file mode 100644 index 0000000..88f5086 --- /dev/null +++ b/tools/samples/JSSResource/mobiledeviceextensionattributes/id/1.json @@ -0,0 +1,16 @@ +{ + "mobile_device_extension_attribute": { + "id": 1, + "name": "Staff Device", + "description": "", + "data_type": "String", + "input_type": { + "type": "Pop-up Menu", + "popup_choices": [ + "No", + "Yes" + ] + }, + "inventory_display": "General" + } +} diff --git a/tools/samples/JSSResource/mobiledevices.json b/tools/samples/JSSResource/mobiledevices.json new file mode 100644 index 0000000..b5b02d8 --- /dev/null +++ b/tools/samples/JSSResource/mobiledevices.json @@ -0,0 +1,100 @@ +{ + "mobile_devices": [ + { + "id": 1, + "name": "Tinas iPad", + "device_name": "Tinas iPad", + "udid": "270aae10800b6e61a2ee2bbc285eb967050b5984", + "serial_number": "C02Q7KHTGFWF", + "phone_number": "", + "wifi_mac_address": "E0:AC:CB:97:36:G4", + "managed": true, + "supervised": true, + "model": "iPhone 6S", + "model_identifier": "iPhone8,1", + "modelDisplay": "iPhone 6S", + "model_display": "iPhone 6S", + "username": "" + }, + { + "id": 2, + "name": "ITiPad003", + "device_name": "ITiPad003", + "udid": "270aae10800b6e61a2ee2bbc285eb967050b7676", + "serial_number": "C02Q7KHTGFFF", + "phone_number": "", + "wifi_mac_address": "E0:AC:CB:97:36:G7", + "managed": true, + "supervised": true, + "model": "iPad Air 2 (CDMA)", + "model_identifier": "iPad5,4", + "modelDisplay": "iPad Air 2 (CDMA)", + "model_display": "iPad Air 2 (CDMA)", + "username": "cconard" + }, + { + "id": 3, + "name": "Test iPad 1", + "device_name": "Test iPad 1", + "udid": "d20d53444b7f97ff38d589c7ce263f9023170ffc", + "serial_number": "MBYI4WHJODMR", + "phone_number": "", + "wifi_mac_address": "d7:81:ed:8b:a5:26", + "managed": true, + "supervised": true, + "model": "iPad 6th Generation (Wi-Fi)", + "model_identifier": "iPad7,5", + "modelDisplay": "iPad 6th Generation (Wi-Fi)", + "model_display": "iPad 6th Generation (Wi-Fi)", + "username": "" + }, + { + "id": 4, + "name": "Test iPad 2", + "device_name": "Test iPad 2", + "udid": "3388ed1ba554a68dabad539c45c820bde212c356", + "serial_number": "O5BAPBYB2GJ0", + "phone_number": "", + "wifi_mac_address": "55:58:93:48:84:6d", + "managed": true, + "supervised": true, + "model": "iPad 6th Generation (Wi-Fi)", + "model_identifier": "iPad7,5", + "modelDisplay": "iPad 6th Generation (Wi-Fi)", + "model_display": "iPad 6th Generation (Wi-Fi)", + "username": "" + }, + { + "id": 5, + "name": "Test iPad 3", + "device_name": "Test iPad 3", + "udid": "1aec6610a9401d2cc47cb55e1a2f7b500ab75864", + "serial_number": "DDRF963ZKGG8", + "phone_number": "", + "wifi_mac_address": "39:05:d6:dd:5a:c3", + "managed": true, + "supervised": true, + "model": "iPad 6th Generation (Wi-Fi)", + "model_identifier": "iPad7,5", + "modelDisplay": "iPad 6th Generation (Wi-Fi)", + "model_display": "iPad 6th Generation (Wi-Fi)", + "username": "" + }, + { + "id": 6, + "name": "CCONARD00IP", + "device_name": "CCONARD00IP", + "udid": "1aec6610a9401d2cc47cb55e1a2f7b500ab76864", + "serial_number": "DDRF963ZFGG8", + "phone_number": "", + "wifi_mac_address": "39:05:d6:dd:5a:c4", + "managed": true, + "supervised": true, + "model": "iPad 6th Generation (Wi-Fi)", + "model_identifier": "iPad7,5", + "modelDisplay": "iPad 6th Generation (Wi-Fi)", + "model_display": "iPad 6th Generation (Wi-Fi)", + "username": "cconard00" + } + ] +} diff --git a/tools/samples/classic_api/mobiledevices.xml b/tools/samples/JSSResource/mobiledevices.xml.old similarity index 100% rename from tools/samples/classic_api/mobiledevices.xml rename to tools/samples/JSSResource/mobiledevices.xml.old diff --git a/tools/samples/JSSResource/mobiledevices/id/5.json b/tools/samples/JSSResource/mobiledevices/id/5.json new file mode 100644 index 0000000..533f8ee --- /dev/null +++ b/tools/samples/JSSResource/mobiledevices/id/5.json @@ -0,0 +1,166 @@ +{ + "mobile_device": { + "general": { + "id": 5, + "display_name": "Test iPad 3", + "device_name": "Test iPad 3", + "name": "Test iPad 3", + "asset_tag": "Test iPad 3", + "last_inventory_update": "Tuesday, November 05 2019 at 6:33 PM", + "last_inventory_update_epoch": 1572978826203, + "last_inventory_update_utc": "2019-11-05T18:33:46.203+0000", + "capacity": 12159, + "capacity_mb": 12159, + "available": 11487, + "available_mb": 11487, + "percentage_used": 5, + "os_type": "iOS", + "os_version": "12.4.1", + "os_build": "14F89", + "software_update_device_id": "", + "serial_number": "DDRF963ZKGG8", + "udid": "1aec6610a9401d2cc47cb55e1a2f7b500ab75864", + "initial_entry_date_epoch": 1572978826099, + "initial_entry_date_utc": "2019-11-05T18:33:46.099+0000", + "phone_number": "", + "ip_address": "192.0.0.1", + "wifi_mac_address": "39:05:d6:dd:5a:c3", + "bluetooth_mac_address": "d7:53:39:18:c3:63", + "modem_firmware": "", + "model": "iPad 6th Generation (Wi-Fi)", + "model_identifier": "iPad7,5", + "model_number": "MR7F2LL", + "modelDisplay": "iPad 6th Generation (Wi-Fi)", + "model_display": "iPad 6th Generation (Wi-Fi)", + "device_ownership_level": "Institutional", + "enrollment_method": "", + "last_enrollment_epoch": 1572978131, + "last_enrollment_utc": "1970-01-19T04:56:18.131+0000", + "mdm_profile_expiration_epoch": 0, + "mdm_profile_expiration_utc": "", + "managed": true, + "supervised": true, + "exchange_activesync_device_identifier": "", + "shared": "No", + "diagnostic_submission": "Not Enabled", + "app_analytics": "Not Enabled", + "tethered": "", + "battery_level": 95, + "ble_capable": false, + "device_locator_service_enabled": false, + "do_not_disturb_enabled": false, + "cloud_backup_enabled": false, + "last_cloud_backup_date_epoch": 0, + "last_cloud_backup_date_utc": "", + "location_services_enabled": false, + "itunes_store_account_is_active": false, + "last_backup_time_epoch": 0, + "last_backup_time_utc": "", + "site": { + "id": -1, + "name": "None" + } + }, + "location": { + "username": "", + "realname": "", + "real_name": "", + "email_address": "", + "position": "", + "phone": "", + "phone_number": "", + "department": "", + "building": "", + "room": "" + }, + "purchasing": { + "is_purchased": true, + "is_leased": false, + "po_number": "", + "vendor": "", + "applecare_id": "", + "purchase_price": "", + "purchasing_account": "", + "po_date": "", + "po_date_epoch": 0, + "po_date_utc": "", + "warranty_expires": "", + "warranty_expires_epoch": 0, + "warranty_expires_utc": "", + "lease_expires": "", + "lease_expires_epoch": 0, + "lease_expires_utc": "", + "life_expectancy": 0, + "purchasing_contact": "", + "attachments": [] + }, + "applications": [], + "security": { + "data_protection": false, + "block_level_encryption_capable": false, + "file_level_encryption_capable": false, + "passcode_present": false, + "passcode_compliant": false, + "passcode_compliant_with_profile": false, + "passcode_lock_grace_period_enforced": "Not Available", + "hardware_encryption": -1, + "activation_lock_enabled": false, + "jailbreak_detected": "Unknown", + "lost_mode_enabled": "Unsupported OS Versione", + "lost_mode_enforced": false, + "lost_mode_enable_issued_epoch": 1572978826094, + "lost_mode_enable_issued_utc": "2019-11-05T18:33:46.094+0000", + "lost_mode_message": "", + "lost_mode_phone": "", + "lost_mode_footnote": "", + "lost_location_epoch": 1712944929317, + "lost_location_utc": "2024-04-12T18:02:09.317+0000", + "lost_location_latitude": 0.0, + "lost_location_longitude": 0.0, + "lost_location_altitude": -1.0, + "lost_location_speed": -1.0, + "lost_location_course": -1.0, + "lost_location_horizontal_accuracy": -1.0, + "lost_location_vertical_accuracy": -1.0 + }, + "network": { + "home_carrier_network": "", + "cellular_technology": "None", + "voice_roaming_enabled": "Not Available", + "imei": "", + "iccid": "", + "meid": "", + "current_carrier_network": "", + "carrier_settings_version": "", + "current_mobile_country_code": "", + "current_mobile_network_code": "", + "home_mobile_country_code": "", + "home_mobile_network_code": "", + "data_roaming_enabled": false, + "roaming": false, + "phone_number": "" + }, + "certificates": [], + "configuration_profiles": [], + "provisioning_profiles": [], + "mobile_device_groups": [ + { + "id": 1, + "name": "All Managed iPads" + }, + { + "id": 4, + "name": "Lost Devices" + } + ], + "extension_attributes": [ + { + "id": 1, + "name": "Staff Device", + "type": "String", + "multi_value": false, + "value": "" + } + ] + } +} diff --git a/tools/samples/JSSResource/mobiledevices/id/5.xml b/tools/samples/JSSResource/mobiledevices/id/5.xml new file mode 100644 index 0000000..f0c15f9 --- /dev/null +++ b/tools/samples/JSSResource/mobiledevices/id/5.xml @@ -0,0 +1,174 @@ + + + + 5 + Test iPad 3 + Test iPad 3 + Test iPad 3 + Test iPad 3 + Tuesday, November 05 2019 at 6:33 PM + 1572978826203 + 2019-11-05T18:33:46.203+0000 + 12159 + 12159 + 11487 + 11487 + 5 + iOS + 12.4.1 + 14F89 + + DDRF963ZKGG8 + 1aec6610a9401d2cc47cb55e1a2f7b500ab75864 + 1572978826099 + 2019-11-05T18:33:46.099+0000 + + 192.0.0.1 + 39:05:d6:dd:5a:c3 + d7:53:39:18:c3:63 + + iPad 6th Generation (Wi-Fi) + iPad7,5 + MR7F2LL + iPad 6th Generation (Wi-Fi) + iPad 6th Generation (Wi-Fi) + Institutional + + 1572978131 + 1970-01-19T04:56:18.131+0000 + 0 + + true + true + + No + Not Enabled + Not Enabled + + 95 + false + false + false + false + 0 + + false + false + 0 + + + -1 + None + + + + + + + + + + + + + + + + true + false + + + + + + + 0 + + + 0 + + + 0 + + 0 + + + + + 0 + + + false + false + false + false + false + false + Not Available + -1 + false + Unknown + Unsupported OS Versione + false + 1572978826094 + 2019-11-05T18:33:46.094+0000 + + + + 1712944906086 + 2024-04-12T18:01:46.086+0000 + 0.0 + 0.0 + -1.0 + -1.0 + -1.0 + -1.0 + -1.0 + + + + None + Not Available + + + + + + + + + + false + false + + + + 0 + + + 0 + + + 0 + + + 2 + + 1 + All Managed iPads + + + 4 + Lost Devices + + + + + 1 + Staff Device + String + false + + + + diff --git a/tools/samples/api/v1/computers-inventory.json b/tools/samples/api/v1/computers-inventory.json new file mode 100644 index 0000000..ef8b491 --- /dev/null +++ b/tools/samples/api/v1/computers-inventory.json @@ -0,0 +1,335 @@ +{ + "totalCount": 5, + "results": [ + { + "id": "5", + "udid": "EBBFF74D-C6B7-5589-93A9-19E8BDFEDE33", + "general": { + "name": "admin’s MacBook Pro", + "lastIpAddress": null, + "lastReportedIp": null, + "jamfBinaryVersion": null, + "platform": "Mac", + "barcode1": null, + "barcode2": null, + "assetTag": null, + "remoteManagement": { + "managed": false, + "managementUsername": null + }, + "supervised": false, + "mdmCapable": { + "capable": false, + "capableUsers": [ + ] + }, + "reportDate": "2022-05-24T11:23:46.837Z", + "lastContactTime": null, + "lastCloudBackupDate": null, + "lastEnrolledDate": null, + "mdmProfileExpiration": null, + "initialEntryDate": "2022-05-24", + "distributionPoint": null, + "site": { + "id": "-1", + "name": "None" + }, + "itunesStoreAccountActive": false, + "enrolledViaAutomatedDeviceEnrollment": false, + "userApprovedMdm": false, + "enrollmentMethod": null, + "declarativeDeviceManagementEnabled": false, + "managementId": "a2f1707d-7f8e-4d99-875a-dd44feed4007", + "extensionAttributes": [ + ] + }, + "diskEncryption": null, + "localUserAccounts": null, + "purchasing": null, + "printers": null, + "storage": null, + "applications": null, + "userAndLocation": null, + "configurationProfiles": null, + "services": null, + "plugins": null, + "hardware": null, + "certificates": null, + "attachments": null, + "packageReceipts": null, + "fonts": null, + "security": null, + "operatingSystem": null, + "licensedSoftware": null, + "softwareUpdates": null, + "groupMemberships": null, + "extensionAttributes": null, + "contentCaching": null, + "ibeacons": null + }, + { + "id": "1", + "udid": "55900BDC-347C-58B1-D249-F32244B11D30", + "general": { + "name": "CConardMBA", + "lastIpAddress": null, + "lastReportedIp": null, + "jamfBinaryVersion": null, + "platform": "Mac", + "barcode1": null, + "barcode2": null, + "assetTag": null, + "remoteManagement": { + "managed": false, + "managementUsername": null + }, + "supervised": false, + "mdmCapable": { + "capable": false, + "capableUsers": [ + ] + }, + "reportDate": "2020-08-21T00:22:01.824Z", + "lastContactTime": null, + "lastCloudBackupDate": null, + "lastEnrolledDate": null, + "mdmProfileExpiration": null, + "initialEntryDate": "2020-06-12", + "distributionPoint": null, + "site": { + "id": "-1", + "name": "None" + }, + "itunesStoreAccountActive": false, + "enrolledViaAutomatedDeviceEnrollment": false, + "userApprovedMdm": false, + "enrollmentMethod": null, + "declarativeDeviceManagementEnabled": false, + "managementId": "867f87e0-04d1-41a3-9a8b-e265adfbf656", + "extensionAttributes": [ + ] + }, + "diskEncryption": null, + "localUserAccounts": null, + "purchasing": null, + "printers": null, + "storage": null, + "applications": null, + "userAndLocation": null, + "configurationProfiles": null, + "services": null, + "plugins": null, + "hardware": null, + "certificates": null, + "attachments": null, + "packageReceipts": null, + "fonts": null, + "security": null, + "operatingSystem": null, + "licensedSoftware": null, + "softwareUpdates": null, + "groupMemberships": null, + "extensionAttributes": null, + "contentCaching": null, + "ibeacons": null + }, + { + "id": "4", + "udid": "CA40DA58-60A3-11E4-90B8-12DF261F2C7E", + "general": { + "name": "Computer 2", + "lastIpAddress": "98.240.177.152", + "lastReportedIp": "192.168.1.219", + "jamfBinaryVersion": "9.6.29507.c", + "platform": "Mac", + "barcode1": null, + "barcode2": null, + "assetTag": "modme", + "remoteManagement": { + "managed": false, + "managementUsername": null + }, + "supervised": false, + "mdmCapable": { + "capable": false, + "capableUsers": [ + ] + }, + "reportDate": "2020-06-27T13:45:53.252Z", + "lastContactTime": "2014-10-30T02:50:55.939Z", + "lastCloudBackupDate": null, + "lastEnrolledDate": "2014-10-28T16:13:59.127Z", + "mdmProfileExpiration": null, + "initialEntryDate": "2020-06-27", + "distributionPoint": null, + "site": { + "id": "-1", + "name": "None" + }, + "itunesStoreAccountActive": false, + "enrolledViaAutomatedDeviceEnrollment": false, + "userApprovedMdm": false, + "enrollmentMethod": null, + "declarativeDeviceManagementEnabled": false, + "managementId": "cbc61ca5-9d52-40a5-b29d-c3caf71200a5", + "extensionAttributes": [ + ] + }, + "diskEncryption": null, + "localUserAccounts": null, + "purchasing": null, + "printers": null, + "storage": null, + "applications": null, + "userAndLocation": null, + "configurationProfiles": null, + "services": null, + "plugins": null, + "hardware": null, + "certificates": null, + "attachments": null, + "packageReceipts": null, + "fonts": null, + "security": null, + "operatingSystem": null, + "licensedSoftware": null, + "softwareUpdates": null, + "groupMemberships": null, + "extensionAttributes": null, + "contentCaching": null, + "ibeacons": null + }, + { + "id": "2", + "udid": "55900BDC-347C-58B1-D249-F32244B11D31", + "general": { + "name": "StuLoanerMBP01", + "lastIpAddress": null, + "lastReportedIp": null, + "jamfBinaryVersion": null, + "platform": "Mac", + "barcode1": null, + "barcode2": null, + "assetTag": null, + "remoteManagement": { + "managed": false, + "managementUsername": null + }, + "supervised": false, + "mdmCapable": { + "capable": false, + "capableUsers": [ + ] + }, + "reportDate": "2020-06-17T23:07:02.21Z", + "lastContactTime": null, + "lastCloudBackupDate": null, + "lastEnrolledDate": null, + "mdmProfileExpiration": null, + "initialEntryDate": "2020-06-17", + "distributionPoint": null, + "site": { + "id": "-1", + "name": "None" + }, + "itunesStoreAccountActive": false, + "enrolledViaAutomatedDeviceEnrollment": false, + "userApprovedMdm": false, + "enrollmentMethod": null, + "declarativeDeviceManagementEnabled": false, + "managementId": "2d011dc3-6a78-42c2-992a-439585fa4106", + "extensionAttributes": [ + ] + }, + "diskEncryption": null, + "localUserAccounts": null, + "purchasing": null, + "printers": null, + "storage": null, + "applications": null, + "userAndLocation": null, + "configurationProfiles": null, + "services": null, + "plugins": null, + "hardware": null, + "certificates": null, + "attachments": null, + "packageReceipts": null, + "fonts": null, + "security": null, + "operatingSystem": null, + "licensedSoftware": null, + "softwareUpdates": null, + "groupMemberships": null, + "extensionAttributes": null, + "contentCaching": null, + "ibeacons": null + }, + { + "id": "3", + "udid": "55900BDC-347C-58B1-D249-F32244B11D66", + "general": { + "name": "StuLoanerMBP02", + "lastIpAddress": null, + "lastReportedIp": null, + "jamfBinaryVersion": null, + "platform": "Mac", + "barcode1": null, + "barcode2": null, + "assetTag": null, + "remoteManagement": { + "managed": false, + "managementUsername": null + }, + "supervised": false, + "mdmCapable": { + "capable": false, + "capableUsers": [ + ] + }, + "reportDate": "2020-06-17T23:07:25.562Z", + "lastContactTime": null, + "lastCloudBackupDate": null, + "lastEnrolledDate": null, + "mdmProfileExpiration": null, + "initialEntryDate": "2020-06-17", + "distributionPoint": null, + "site": { + "id": "-1", + "name": "None" + }, + "itunesStoreAccountActive": false, + "enrolledViaAutomatedDeviceEnrollment": false, + "userApprovedMdm": false, + "enrollmentMethod": null, + "declarativeDeviceManagementEnabled": false, + "managementId": "36894a90-09eb-4eb2-a0b7-7f33e339ed5a", + "extensionAttributes": [ + ] + }, + "diskEncryption": null, + "localUserAccounts": null, + "purchasing": null, + "printers": null, + "storage": null, + "applications": null, + "userAndLocation": null, + "configurationProfiles": null, + "services": null, + "plugins": null, + "hardware": null, + "certificates": null, + "attachments": null, + "packageReceipts": null, + "fonts": null, + "security": null, + "operatingSystem": null, + "licensedSoftware": null, + "softwareUpdates": null, + "groupMemberships": null, + "extensionAttributes": null, + "contentCaching": null, + "ibeacons": null + } + ] +} diff --git a/tools/samples/api/v2/mobile-devices.json b/tools/samples/api/v2/mobile-devices.json new file mode 100644 index 0000000..ff1e2f2 --- /dev/null +++ b/tools/samples/api/v2/mobile-devices.json @@ -0,0 +1,89 @@ +{ + "totalCount": 6, + "results": [ + { + "id": "1", + "name": "Tinas iPad", + "model": "iPhone 6S", + "modelIdentifier": "iPhone8,1", + "serialNumber": "C02Q7KHTGFWF", + "udid": "270aae10800b6e61a2ee2bbc285eb967050b5984", + "wifiMacAddress": "E0:AC:CB:97:36:G4", + "phoneNumber": null, + "username": null, + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "9443690c-7927-42e9-b172-5367e6ccab24" + }, + { + "id": "2", + "name": "ITiPad003", + "model": "iPad Air 2 (CDMA)", + "modelIdentifier": "iPad5,4", + "serialNumber": "C02Q7KHTGFFF", + "udid": "270aae10800b6e61a2ee2bbc285eb967050b7676", + "wifiMacAddress": "E0:AC:CB:97:36:G7", + "phoneNumber": null, + "username": "cconard", + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "7720e03d-41f5-4091-9f13-b5d5b9c576e3" + }, + { + "id": "3", + "name": "Test iPad 1", + "model": "iPad 6th Generation (Wi-Fi)", + "modelIdentifier": "iPad7,5", + "serialNumber": "MBYI4WHJODMR", + "udid": "d20d53444b7f97ff38d589c7ce263f9023170ffc", + "wifiMacAddress": "d7:81:ed:8b:a5:26", + "phoneNumber": null, + "username": null, + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "f9e43b5d-278a-4899-a95f-78d034e37b02" + }, + { + "id": "4", + "name": "Test iPad 2", + "model": "iPad 6th Generation (Wi-Fi)", + "modelIdentifier": "iPad7,5", + "serialNumber": "O5BAPBYB2GJ0", + "udid": "3388ed1ba554a68dabad539c45c820bde212c356", + "wifiMacAddress": "55:58:93:48:84:6d", + "phoneNumber": null, + "username": null, + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "6a4e765b-caad-4a3b-ad94-364941b2620f" + }, + { + "id": "5", + "name": "Test iPad 3", + "model": "iPad 6th Generation (Wi-Fi)", + "modelIdentifier": "iPad7,5", + "serialNumber": "DDRF963ZKGG8", + "udid": "1aec6610a9401d2cc47cb55e1a2f7b500ab75864", + "wifiMacAddress": "39:05:d6:dd:5a:c3", + "phoneNumber": null, + "username": null, + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "e91906fb-9406-4f06-a7a9-874e556d2bc0" + }, + { + "id": "6", + "name": "CCONARD00IP", + "model": "iPad 6th Generation (Wi-Fi)", + "modelIdentifier": "iPad7,5", + "serialNumber": "DDRF963ZFGG8", + "udid": "1aec6610a9401d2cc47cb55e1a2f7b500ab76864", + "wifiMacAddress": "39:05:d6:dd:5a:c4", + "phoneNumber": null, + "username": "cconard00", + "type": "ios", + "softwareUpdateDeviceId": null, + "managementId": "88dc548b-a3f5-4b2f-a798-f859ae91a8cf" + } + ] +} diff --git a/tools/samples/classic_api/computerextensionattributes.json b/tools/samples/classic_api/computerextensionattributes.json deleted file mode 100644 index 7b83b08..0000000 --- a/tools/samples/classic_api/computerextensionattributes.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "computer_extension_attributes": [ - { - "id": 16, - "name": "Battery Cycle Count", - "enabled": true - }, - { - "id": 1, - "name": "Get Application's Developer Name", - "enabled": true - }, - { - "id": 15, - "name": "JNUC-2019-LabUser", - "enabled": true - }, - { - "id": 2, - "name": "Usage Policy Violation", - "enabled": true - } - ] -} diff --git a/tools/samples/classic_api/computerextensionattributes/id/1.json b/tools/samples/classic_api/computerextensionattributes/id/1.json deleted file mode 100644 index bedabe6..0000000 --- a/tools/samples/classic_api/computerextensionattributes/id/1.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "computer_extension_attribute": { - "id": 1, - "name": "Get Application's Developer Name", - "enabled": true, - "description": "Get Application's Developer Name", - "data_type": "String", - "input_type": { - "type": "Text Field" - }, - "inventory_display": "General", - "recon_display": "Extension Attributes" - } -} diff --git a/tools/samples/classic_api/computerextensionattributes/id/15.json b/tools/samples/classic_api/computerextensionattributes/id/15.json deleted file mode 100644 index 37995e2..0000000 --- a/tools/samples/classic_api/computerextensionattributes/id/15.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "computer_extension_attribute": { - "id": 15, - "name": "JNUC-2019-LabUser", - "enabled": true, - "description": "The name of the lab attendee who created this computer", - "data_type": "String", - "input_type": { - "type": "Text Field" - }, - "inventory_display": "Extension Attributes", - "recon_display": "Extension Attributes" - } -} diff --git a/tools/samples/classic_api/computerextensionattributes/id/16.json b/tools/samples/classic_api/computerextensionattributes/id/16.json deleted file mode 100644 index 3d3223a..0000000 --- a/tools/samples/classic_api/computerextensionattributes/id/16.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "computer_extension_attribute": { - "id": 16, - "name": "Battery Cycle Count", - "enabled": true, - "description": "Number of charge cycles logged on the current battery", - "data_type": "String", - "input_type": { - "type": "Text Field" - }, - "inventory_display": "General", - "recon_display": "Extension Attributes" - } -} diff --git a/tools/samples/classic_api/computerextensionattributes/id/2.json b/tools/samples/classic_api/computerextensionattributes/id/2.json deleted file mode 100644 index 1add6e0..0000000 --- a/tools/samples/classic_api/computerextensionattributes/id/2.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "computer_extension_attribute": { - "id": 2, - "name": "Usage Policy Violation", - "enabled": true, - "description": "Triggered if Management is disabled", - "data_type": "String", - "input_type": { - "type": "Text Field" - }, - "inventory_display": "General", - "recon_display": "Extension Attributes" - } -} diff --git a/tools/samples/classic_api/computers.json b/tools/samples/classic_api/computers.json deleted file mode 100644 index 3841c26..0000000 --- a/tools/samples/classic_api/computers.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "computers": [ - { - "id": 33, - "name": "Computer 2" - }, - { - "id": 38, - "name": "Computer 3" - }, - { - "id": 39, - "name": "Computer 4" - }, - { - "id": 40, - "name": "Computer 5" - }, - { - "id": 43, - "name": "Computer 6" - } - ] -} \ No newline at end of file diff --git a/tools/samples/classic_api/computers.xml b/tools/samples/classic_api/computers.xml deleted file mode 100644 index 2242b72..0000000 --- a/tools/samples/classic_api/computers.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 5 - - 33 - Computer 2 - - - 38 - Computer 3 - - - 39 - Computer 4 - - - 40 - Computer 5 - - - 43 - Computer 6 - - \ No newline at end of file diff --git a/tools/samples/classic_api/computers/id/33.json b/tools/samples/classic_api/computers/id/33.json deleted file mode 100644 index 273a0ca..0000000 --- a/tools/samples/classic_api/computers/id/33.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "computer": { - "general": { - "id": "33", - "name": "Computer 2", - "network_adapter_type": "", - "mac_address": "C8:2A:14:0C:43:24", - "alt_network_adapter_type": "", - "alt_mac_address": "E0:F8:47:08:39:A6", - "ip_address": "98.240.177.152", - "last_reported_ip": "192.168.1.219", - "serial_number": "CA40DA6C60A3", - "udid": "CA40DA58-60A3-11E4-90B8-12DF261F2C7E", - "jamf_version": "9.6.29507.c", - "platform": "Mac", - "barcode_1": "", - "barcode_2": "", - "asset_tag": "modme", - "remote_management": { - "managed": false, - "management_username": "", - "management_password_sha256": "fb51ba4173a5613db2c79c8c12741b803239583ffeb966946a230d9aeecd417d" - }, - "supervised": false, - "mdm_capable": false, - "mdm_capable_users": {}, - "report_date": "2020-03-16 17:04:32", - "report_date_epoch": 1584378272764, - "report_date_utc": "2020-03-16T17:04:32.764+0000", - "last_contact_time": "2014-10-30 02:50:55", - "last_contact_time_epoch": 1414637455939, - "last_contact_time_utc": "2014-10-30T02:50:55.939+0000", - "initial_entry_date": "2014-08-19", - "initial_entry_date_epoch": 1408479491599, - "initial_entry_date_utc": "2014-08-19T20:18:11.599+0000", - "last_cloud_backup_date_epoch": 0, - "last_cloud_backup_date_utc": "", - "last_enrolled_date_epoch": 1414512839127, - "last_enrolled_date_utc": "2014-10-28T16:13:59.127+0000", - "distribution_point": "", - "sus": "", - "netboot_server": "", - "site": { - "id": -1, - "name": "None" - }, - "itunes_store_account_is_active": false - }, - "location": { - "username": "user17", - "realname": "User 17", - "real_name": "User 17", - "email_address": "User17@email.com", - "position": "", - "phone": "612-605-6625", - "phone_number": "612-605-6625", - "department": "", - "building": "Minneapolis", - "room": "301 4th Avenue S\r\nSuite 1075" - }, - "purchasing": { - "is_purchased": true, - "is_leased": false, - "po_number": "", - "vendor": "", - "applecare_id": "", - "purchase_price": "", - "purchasing_account": "", - "po_date": "2011-02-25", - "po_date_epoch": 1298613600000, - "po_date_utc": "2011-02-25T06:00:00.000+0000", - "warranty_expires": "2014-02-24", - "warranty_expires_epoch": 1393221600000, - "warranty_expires_utc": "2014-02-24T06:00:00.000+0000", - "lease_expires": "", - "lease_expires_epoch": 0, - "lease_expires_utc": "", - "life_expectancy": 0, - "purchasing_contact": "", - "os_applecare_id": "", - "os_maintenance_expires": "", - "attachments": [] - }, - "peripherals": [], - "hardware": { - "make": "Apple", - "model": "13-inch MacBook Pro (2011)", - "model_identifier": "MacBookPro8,1", - "os_name": "Mac OS X", - "os_version": "10.10.0", - "os_build": "14A389", - "master_password_set": true, - "active_directory_status": "Not Bound", - "service_pack": "", - "processor_type": "Intel Core i5", - "processor_architecture": "i386", - "processor_speed": 2300, - "processor_speed_mhz": 2300, - "number_processors": 2, - "number_cores": 4, - "total_ram": 16384, - "total_ram_mb": 16384, - "boot_rom": "MBP81.0047.B27", - "bus_speed": 0, - "bus_speed_mhz": 0, - "battery_capacity": 77, - "cache_size": 3072, - "cache_size_kb": 3072, - "available_ram_slots": 0, - "optical_drive": "", - "nic_speed": "n/a", - "smc_version": "1.68f99", - "ble_capable": false, - "sip_status": "Not collected", - "gatekeeper_status": "Not collected", - "xprotect_version": "", - "institutional_recovery_key": "Present", - "disk_encryption_configuration": "JAMF Institutional", - "filevault2_users": [ - "demoadmin", - "demoadmin", - "demoadmin" - ], - "storage": [ - { - "disk": "disk0", - "model": "M4-CT256M4SSD2", - "revision": "040H", - "serial_number": "000000001307092B4094", - "size": 262205, - "drive_capacity_mb": 262205, - "connection_type": "NO", - "smart_status": "Verified", - "partitions": [ - { - "name": "Mac (Boot Partition)", - "size": 242281, - "type": "boot", - "partition_capacity_mb": 242281, - "percentage_full": 74, - "available_mb": 179288, - "filevault_status": "Encrypted", - "filevault_percent": 100, - "filevault2_status": "Encrypted", - "filevault2_percent": 100, - "boot_drive_available_mb": -1, - "lvgUUID": "0DDE4907-633D-4CE7-BA6B-4790018C4A77", - "lvUUID": "77FF93E0-F314-49C8-BA18-DE39A77476AE", - "pvUUID": "08634549-605F-4874-814A-2E6777336A58" - } - ] - }, - { - "disk": "disk1", - "model": "Hitachi HTS725050A9A364", - "revision": "PC4OC70E", - "serial_number": "100726PCK400VLJUKA4J", - "size": 512113, - "drive_capacity_mb": 512113, - "connection_type": "NO", - "smart_status": "Verified", - "partitions": [ - { - "name": "Macintosh HD", - "size": 476120, - "type": "other", - "partition_capacity_mb": 476120, - "percentage_full": 88, - "available_mb": 418986, - "filevault_status": "Encrypted", - "filevault_percent": 100, - "filevault2_status": "Encrypted", - "filevault2_percent": 100 - } - ] - }, - { - "disk": "disk3", - "model": "", - "revision": "", - "serial_number": "", - "size": 731, - "drive_capacity_mb": 731, - "connection_type": "", - "smart_status": "", - "partitions": [ - { - "name": "Parallels Desktop 10 (Boot Partition)", - "size": 731, - "type": "other", - "partition_capacity_mb": 731, - "percentage_full": 77, - "available_mb": 563, - "filevault_status": "Encrypted", - "filevault_percent": 100, - "filevault2_status": "Encrypted", - "filevault2_percent": 100 - } - ] - } - ], - "mapped_printers": [] - }, - "certificates": [], - "security": { - "activation_lock": false, - "secure_boot_level": "unknown", - "external_boot_level": "unknown" - }, - "software": { - "unix_executables": [], - "licensed_software": [], - "installed_by_casper": [], - "installed_by_installer_swu": [ - "appleconfigurator1.2.1", - "caspersuite", - "caspersuitesdk", - "com.jamfsoftware.osxenrollment", - "com.jamfsw.401kpolicyupdate.2014-09-19", - "com.jamfsw.crashplanproe.2013-11-12", - "com.jamfsw.HPLJEM575dn.2014-02-28", - "com.jamfsw.microsoftlync.galcontactsfix.131028", - "com.jamfsw.microsoftlync.galcontactsfix.20140123", - "com.jamfsw.osxServerAppMountainLion1085.130919", - "com.jamfsw.parallelsdesktop10.20140821", - "com.jamfsw.ParallelsDesktop9.131008" - ], - "cached_by_casper": [], - "available_software_updates": [], - "available_updates": {}, - "running_services": [], - "applications": [ - { - "name": "01_Recon.app", - "path": "/Applications/CasperSuite-9_51/01_Recon.app", - "version": "9.51" - }, - { - "name": "02_Composer.app", - "path": "/Applications/CasperSuite-9_51/02_Composer.app", - "version": "9.51" - }, - { - "name": "03_Casper Admin.app", - "path": "/Applications/CasperSuite-9_51/03_Casper Admin.app", - "version": "9.51" - }, - { - "name": "04_Casper Imaging.app", - "path": "/Applications/CasperSuite-9_51/04_Casper Imaging.app", - "version": "9.51" - }, - { - "name": "05_Casper Remote.app", - "path": "/Applications/CasperSuite-9_51/05_Casper Remote.app", - "version": "9.51" - } - ], - "fonts": [], - "plugins": [ - { - "name": "AdobePDFViewer.plugin", - "path": "/Library/Internet Plug-Ins/AdobePDFViewer.plugin", - "version": "10.1.12" - }, - { - "name": "AdobePDFViewerNPAPI.plugin", - "path": "/Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin", - "version": "10.1.12" - }, - { - "name": "ZoomUsPlugIn.plugin", - "path": "/Users/bhansen/Library/Internet Plug-Ins/ZoomUsPlugIn.plugin", - "version": "2.5.40065.0120" - } - ] - }, - "extension_attributes": [ - { - "id": 16, - "name": "Battery Cycle Count", - "type": "String", - "multi_value": false, - "value": "" - }, - { - "id": 1, - "name": "Get Application's Developer Name", - "type": "String", - "multi_value": false, - "value": "" - }, - { - "id": 15, - "name": "JNUC-2019-LabUser", - "type": "String", - "multi_value": false, - "value": "" - }, - { - "id": 2, - "name": "Usage Policy Violation", - "type": "String", - "multi_value": false, - "value": "" - } - ], - "groups_accounts": { - "computer_group_memberships": [ - "Repairs_api" - ], - "local_accounts": [], - "user_inventories": { - "disable_automatic_login": true - } - }, - "iphones": [], - "configuration_profiles": [] - } -} \ No newline at end of file diff --git a/tools/samples/classic_api/computers/id/33.xml b/tools/samples/classic_api/computers/id/33.xml deleted file mode 100644 index 68035f8..0000000 --- a/tools/samples/classic_api/computers/id/33.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - 33 - Computer 2 - - C8:2A:14:0C:43:24 - - E0:F8:47:08:39:A6 - 98.240.177.152 - 192.168.1.219 - CA40DA6C60A3 - CA40DA58-60A3-11E4-90B8-12DF261F2C7E - 9.6.29507.c - Mac - - - modme - - false - - fb51ba4173a5613db2c79c8c12741b803239583ffeb966946a230d9aeecd417d - - false - false - - 2020-03-16 17:04:32 - 1584378272764 - 2020-03-16T17:04:32.764+0000 - 2014-10-30 02:50:55 - 1414637455939 - 2014-10-30T02:50:55.939+0000 - 2014-08-19 - 1408479491599 - 2014-08-19T20:18:11.599+0000 - 0 - - 1414512839127 - 2014-10-28T16:13:59.127+0000 - - - - - -1 - None - - false - - - user17 - User 17 - User 17 - User17@email.com - - 612-605-6625 - 612-605-6625 - - Minneapolis - 301 4th Avenue S - Suite 1075 - - - true - false - - - - - - 2011-02-25 - 1298613600000 - 2011-02-25T06:00:00.000+0000 - 2014-02-24 - 1393221600000 - 2014-02-24T06:00:00.000+0000 - - 0 - - 0 - - - - - - - 0 - - - Apple - 13-inch MacBook Pro (2011) - MacBookPro8,1 - Mac OS X - 10.10.0 - 14A389 - true - Not Bound - - Intel Core i5 - i386 - 2300 - 2300 - 2 - 4 - 16384 - 16384 - MBP81.0047.B27 - 0 - 0 - 77 - 3072 - 3072 - 0 - - n/a - 1.68f99 - false - Not collected - Not collected - - Present - JAMF Institutional - - demoadmin - demoadmin - demoadmin - - - - disk0 - M4-CT256M4SSD2 - 040H - 000000001307092B4094 - 262205 - 262205 - NO - Verified - - - Mac (Boot Partition) - 242281 - boot - 242281 - 74 - 179288 - Encrypted - 100 - Encrypted - 100 - -1 - 0DDE4907-633D-4CE7-BA6B-4790018C4A77 - 77FF93E0-F314-49C8-BA18-DE39A77476AE - 08634549-605F-4874-814A-2E6777336A58 - - - - - disk1 - Hitachi HTS725050A9A364 - PC4OC70E - 100726PCK400VLJUKA4J - 512113 - 512113 - NO - Verified - - - Macintosh HD - 476120 - other - 476120 - 88 - 418986 - Encrypted - 100 - Encrypted - 100 - - - - - disk3 - - - - 731 - 731 - - - - - Parallels Desktop 10 (Boot Partition) - 731 - other - 731 - 77 - 563 - Encrypted - 100 - Encrypted - 100 - - - - - - - - - false - unknown - unknown - - - - - - - appleconfigurator1.2.1 - caspersuite - caspersuitesdk - com.jamfsoftware.osxenrollment - com.jamfsw.401kpolicyupdate.2014-09-19 - com.jamfsw.crashplanproe.2013-11-12 - com.jamfsw.HPLJEM575dn.2014-02-28 - com.jamfsw.microsoftlync.galcontactsfix.131028 - com.jamfsw.microsoftlync.galcontactsfix.20140123 - com.jamfsw.osxServerAppMountainLion1085.130919 - com.jamfsw.parallelsdesktop10.20140821 - com.jamfsw.ParallelsDesktop9.131008 - - - - - - - 5 - - 01_Recon.app - /Applications/CasperSuite-9_51/01_Recon.app - 9.51 - - - 02_Composer.app - /Applications/CasperSuite-9_51/02_Composer.app - 9.51 - - - 03_Casper Admin.app - /Applications/CasperSuite-9_51/03_Casper Admin.app - 9.51 - - - 04_Casper Imaging.app - /Applications/CasperSuite-9_51/04_Casper Imaging.app - 9.51 - - - 05_Casper Remote.app - /Applications/CasperSuite-9_51/05_Casper Remote.app - 9.51 - - - - 0 - - - 25 - - AdobePDFViewer.plugin - /Library/Internet Plug-Ins/AdobePDFViewer.plugin - 10.1.12 - - - AdobePDFViewerNPAPI.plugin - /Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin - 10.1.12 - - - ZoomUsPlugIn.plugin - /Users/bhansen/Library/Internet Plug-Ins/ZoomUsPlugIn.plugin - 2.5.40065.0120 - - - - - - 16 - Battery Cycle Count - String - false - - - - 1 - Get Application's Developer Name - String - false - - - - 15 - JNUC-2019-LabUser - String - false - - - - 2 - Usage Policy Violation - String - false - - - - - - Repairs_api - - - - true - - - - 0 - - - 0 - - \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes.json b/tools/samples/classic_api/mobiledeviceextensionattributes.json deleted file mode 100644 index 0183b35..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "mobile_device_extension_attributes": [ - { - "id": 3, - "name": "Asset Selector" - }, - { - "id": 4, - "name": "Staff device" - } - ] -} diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes.xml b/tools/samples/classic_api/mobiledeviceextensionattributes.xml deleted file mode 100644 index d4d1597..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - 2 - - 3 - Asset Selector - - - 4 - Staff device - - \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.json b/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.json deleted file mode 100644 index abf1252..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "mobile_device_extension_attribute": { - "id": 3, - "name": "Asset Selector", - "description": "string", - "data_type": "String", - "input_type": { - "type": "Text Field" - }, - "inventory_display": "General" - } -} \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.xml b/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.xml deleted file mode 100644 index b4f9354..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes/id/3.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 3 - Asset Selector - string - String - - Text Field - - General - \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.json b/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.json deleted file mode 100644 index a206191..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "mobile_device_extension_attribute": { - "id": 4, - "name": "Staff device", - "description": "", - "data_type": "String", - "input_type": { - "type": "Pop-up Menu", - "popup_choices": [ - "No", - "Yes" - ] - }, - "inventory_display": "General" - } -} \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.xml b/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.xml deleted file mode 100644 index 7fb6b0c..0000000 --- a/tools/samples/classic_api/mobiledeviceextensionattributes/id/4.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4 - Staff device - - String - - Pop-up Menu - - No - Yes - - - General - \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledevices.json b/tools/samples/classic_api/mobiledevices.json deleted file mode 100644 index 525ea82..0000000 --- a/tools/samples/classic_api/mobiledevices.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "mobile_devices": [ - { - "id": 28, - "name": "Device 2", - "device_name": "Device 2", - "udid": "ca44c88e60a311e490b812df261f2c7e", - "serial_number": "CA44C89860A3", - "phone_number": "612-605-6625", - "wifi_mac_address": "AC:3C:0B:5E:50:93", - "managed": true, - "supervised": false, - "model": "iPad mini (CDMA)", - "model_identifier": "iPad2,7", - "modelDisplay": "iPad mini (CDMA)", - "model_display": "iPad mini (CDMA)", - "username": "user71" - }, - { - "id": 35, - "name": "Device 3", - "device_name": "Device 3", - "udid": "ca44c96060a311e490b812df261f2c7e", - "serial_number": "CA44C96A60A3", - "phone_number": "612-605-6625", - "wifi_mac_address": "54:EA:A8:3A:DC:E3", - "managed": true, - "supervised": false, - "model": "iPhone 5 (CDMA)", - "model_identifier": "iPhone5,2", - "modelDisplay": "iPhone 5 (CDMA)", - "model_display": "iPhone 5 (CDMA)", - "username": "user48" - }, - { - "id": 48, - "name": "Device 4", - "device_name": "Device 4", - "udid": "ca44ca8c60a311e490b812df261f2c7e", - "serial_number": "CA44CA9660A3", - "phone_number": "612-605-6625", - "wifi_mac_address": "5C:96:9D:15:B7:CF", - "managed": true, - "supervised": false, - "model": "iPad mini (CDMA)", - "model_identifier": "iPad2,7", - "modelDisplay": "iPad mini (CDMA)", - "model_display": "iPad mini (CDMA)", - "username": "user82" - }, - { - "id": 49, - "name": "Device 5", - "device_name": "Device 5", - "udid": "ca44cafa60a311e490b812df261f2c7e", - "serial_number": "CA44CB0460A3", - "phone_number": "612-605-6625", - "wifi_mac_address": "70:DE:E2:89:96:C6", - "managed": true, - "supervised": false, - "model": "iPad 2 (Wi-Fi)", - "model_identifier": "iPad2,1", - "modelDisplay": "iPad 2 (Wi-Fi)", - "model_display": "iPad 2 (Wi-Fi)", - "username": "user82" - }, - { - "id": 50, - "name": "Device 6", - "device_name": "Device 6", - "udid": "ca44cb6860a311e490b812df261f2c7e", - "serial_number": "CA44CB7260A3", - "phone_number": "612-605-6625", - "wifi_mac_address": "18:20:32:B1:AB:5F", - "managed": true, - "supervised": false, - "model": "iPad 2 (Wi-Fi)", - "model_identifier": "iPad2,1", - "modelDisplay": "iPad 2 (Wi-Fi)", - "model_display": "iPad 2 (Wi-Fi)", - "username": "user82" - } - ] -} diff --git a/tools/samples/classic_api/mobiledevices/id/28.json b/tools/samples/classic_api/mobiledevices/id/28.json deleted file mode 100644 index 9e2b988..0000000 --- a/tools/samples/classic_api/mobiledevices/id/28.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "mobile_device": { - "general": { - "id": 28, - "display_name": "Device 2", - "device_name": "Device 2", - "name": "Device 2", - "asset_tag": "string1234", - "last_inventory_update": "Monday, March 16 2020 at 5:01 PM", - "last_inventory_update_epoch": 1584378100868, - "last_inventory_update_utc": "2020-03-16T17:01:40.868+0000", - "capacity": 12957, - "capacity_mb": 12957, - "available": 2838, - "available_mb": 2838, - "percentage_used": 78, - "os_type": "iOS", - "os_version": "8.1", - "os_build": "12B410", - "serial_number": "CA44C89860A3", - "udid": "ca44c88e60a311e490b812df261f2c7e", - "initial_entry_date_epoch": 1408598573022, - "initial_entry_date_utc": "2014-08-21T05:22:53.022+0000", - "phone_number": "2244229909", - "ip_address": "63.149.27.134", - "wifi_mac_address": "AC:3C:0B:5E:50:93", - "bluetooth_mac_address": "AC:3C:0B:5E:50:94", - "modem_firmware": "7.03.00", - "model": "iPad mini (CDMA)", - "model_identifier": "iPad2,7", - "model_number": "MD540LL", - "modelDisplay": "iPad mini (CDMA)", - "model_display": "iPad mini (CDMA)", - "device_ownership_level": "Institutional", - "last_enrollment_epoch": 1408807164775, - "last_enrollment_utc": "2014-08-23T15:19:24.775+0000", - "managed": true, - "supervised": false, - "exchange_activesync_device_identifier": "", - "shared": "No", - "diagnostic_submission": "Not Enabled", - "app_analytics": "Not Enabled", - "tethered": "", - "battery_level": 56, - "ble_capable": true, - "device_locator_service_enabled": true, - "do_not_disturb_enabled": false, - "cloud_backup_enabled": true, - "last_cloud_backup_date_epoch": 1414500473000, - "last_cloud_backup_date_utc": "2014-10-28T12:47:53.000+0000", - "location_services_enabled": false, - "itunes_store_account_is_active": true, - "last_backup_time_epoch": 0, - "last_backup_time_utc": "", - "site": { - "id": -1, - "name": "None" - } - }, - "location": { - "username": "user71", - "realname": "User 71", - "real_name": "User 71", - "email_address": "User71@email.com", - "position": "", - "phone": "612-605-6625", - "phone_number": "612-605-6625", - "department": "", - "building": "US Field", - "room": "904 S. Roselle Rd #110" - }, - "purchasing": { - "is_purchased": true, - "is_leased": false, - "po_number": "", - "vendor": "", - "applecare_id": "", - "purchase_price": "", - "purchasing_account": "", - "po_date": "2013-07-11", - "po_date_epoch": 1373518800000, - "po_date_utc": "2013-07-11T05:00:00.000+0000", - "warranty_expires": "", - "warranty_expires_epoch": 0, - "warranty_expires_utc": "", - "lease_expires": "", - "lease_expires_epoch": 0, - "lease_expires_utc": "", - "life_expectancy": 0, - "purchasing_contact": "", - "attachments": [] - }, - "applications": [ - { - "application_name": "1Password", - "application_version": "501017", - "identifier": "com.agilebits.onepassword-ios" - }, - { - "application_name": "Adobe Ideas", - "application_version": "52469", - "identifier": "com.adobe.ideas.ipad" - }, - { - "application_name": "Airbnb", - "application_version": "4.4.1", - "identifier": "com.airbnb.app" - }, - { - "application_name": "AirPort Utility", - "application_version": "134.22", - "identifier": "com.apple.airport.mobileairportutility" - }, - { - "application_name": "American", - "application_version": "3.8.0", - "identifier": "com.aa.AmericanAirlines" - }, - { - "application_name": "Ancestry", - "application_version": "2920", - "identifier": "com.ancestry.Tree-To-Go" - }, - { - "application_name": "Apple Store", - "application_version": "3.1.0", - "identifier": "com.apple.store.Jolly" - } - ], - "security": { - "data_protection": true, - "block_level_encryption_capable": true, - "file_level_encryption_capable": true, - "passcode_present": true, - "passcode_compliant": true, - "passcode_compliant_with_profile": true, - "passcode_lock_grace_period_enforced": "Not Available", - "hardware_encryption": 3, - "activation_lock_enabled": true, - "jailbreak_detected": "Normal", - "lost_mode_enabled": "Unsupervised Device", - "lost_mode_enforced": false, - "lost_mode_enable_issued_epoch": 0, - "lost_mode_enable_issued_utc": "", - "lost_mode_message": "", - "lost_mode_phone": "", - "lost_mode_footnote": "", - "lost_location_epoch": 1593224942015, - "lost_location_utc": "2020-06-27T02:29:02.015+0000", - "lost_location_latitude": 0.0, - "lost_location_longitude": 0.0, - "lost_location_altitude": -1.0, - "lost_location_speed": -1.0, - "lost_location_course": -1.0, - "lost_location_horizontal_accuracy": -1.0, - "lost_location_vertical_accuracy": -1.0 - }, - "network": { - "home_carrier_network": "Verizon", - "cellular_technology": "Both", - "voice_roaming_enabled": "No", - "imei": "99 000290 140632 0", - "iccid": "8914 8000 0006 0230 8992", - "meid": "99000290140632", - "current_carrier_network": "", - "carrier_settings_version": "18.0", - "current_mobile_country_code": "311", - "current_mobile_network_code": "480", - "home_mobile_country_code": "311", - "home_mobile_network_code": "480", - "data_roaming_enabled": false, - "roaming": false, - "phone_number": "2244229909" - }, - "certificates": [], - "configuration_profiles": [], - "provisioning_profiles": [], - "mobile_device_groups": [ - { - "id": 3, - "name": "All Managed iPod touches" - }, - { - "id": 4, - "name": "Config Profile: Does not have Managed Device" - }, - { - "id": 20, - "name": "I'm a cool test" - }, - { - "id": 6, - "name": "Test" - }, - { - "id": 7, - "name": "Pats test2" - }, - { - "id": 8, - "name": "All Managed iPads" - }, - { - "id": 11, - "name": "iPhones" - } - ], - "extension_attributes": [ - { - "id": 3, - "name": "Asset Selector", - "type": "String", - "multi_value": false, - "value": "" - } - ] - } -} \ No newline at end of file diff --git a/tools/samples/classic_api/mobiledevices/id/28.xml b/tools/samples/classic_api/mobiledevices/id/28.xml deleted file mode 100644 index cca7c70..0000000 --- a/tools/samples/classic_api/mobiledevices/id/28.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - 28 - Device 2 - Device 2 - Device 2 - string1234 - Monday, March 16 2020 at 5:01 PM - 1584378100868 - 2020-03-16T17:01:40.868+0000 - 12957 - 12957 - 2838 - 2838 - 78 - iOS - 8.1 - 12B410 - CA44C89860A3 - ca44c88e60a311e490b812df261f2c7e - 1408598573022 - 2014-08-21T05:22:53.022+0000 - 2244229909 - 63.149.27.134 - AC:3C:0B:5E:50:93 - AC:3C:0B:5E:50:94 - 7.03.00 - iPad mini (CDMA) - iPad2,7 - MD540LL - iPad mini (CDMA) - iPad mini (CDMA) - Institutional - 1408807164775 - 2014-08-23T15:19:24.775+0000 - true - false - - No - Not Enabled - Not Enabled - - 56 - true - true - false - true - 1414500473000 - 2014-10-28T12:47:53.000+0000 - false - true - 0 - - - -1 - None - - - - user71 - User 71 - User 71 - User71@email.com - - 612-605-6625 - 612-605-6625 - - US Field - 904 S. Roselle Rd #110 - - - true - false - - - - - - 2013-07-11 - 1373518800000 - 2013-07-11T05:00:00.000+0000 - - 0 - - - 0 - - 0 - - - - - 122 - - 1Password - 501017 - com.agilebits.onepassword-ios - - - Adobe Ideas - 52469 - com.adobe.ideas.ipad - - - Airbnb - 4.4.1 - com.airbnb.app - - - AirPort Utility - 134.22 - com.apple.airport.mobileairportutility - - - American - 3.8.0 - com.aa.AmericanAirlines - - - Ancestry - 2920 - com.ancestry.Tree-To-Go - - - Apple Store - 3.1.0 - com.apple.store.Jolly - - - - true - true - true - true - true - true - Not Available - 3 - true - Normal - Unsupervised Device - false - 0 - - - - - 1593224890021 - 2020-06-27T02:28:10.021+0000 - 0.0 - 0.0 - -1.0 - -1.0 - -1.0 - -1.0 - -1.0 - - - Verizon - Both - No - 99 000290 140632 0 - 8914 8000 0006 0230 8992 - 99000290140632 - - 18.0 - 311 - 480 - 311 - 480 - false - false - 2244229909 - - - 0 - - - 0 - - - 0 - - - 7 - - 3 - All Managed iPod touches - - - 4 - Config Profile: Does not have Managed Device - - - 20 - I'm a cool test - - - 6 - Test - - - 7 - Pats test2 - - - 8 - All Managed iPads - - - 11 - iPhones - - - - - 3 - Asset Selector - String - false - - - - \ No newline at end of file