Commit Graph

31 Commits

Author SHA1 Message Date
mosen
e4ab7e0b17 Hotfix/last check in (#34)
* Convert all time.Time pointers to value types.
Use UTC time when updating `last_checkin`.
Update `last_checkin` correctly on Authenticate, TokenUpdate, and query response.
Set database defaults to golangs zero value for time.Time which is `0001-01-01`.

* Add down migration for time defaults.
2016-10-12 16:20:48 +11:00
mosen
8c192d456d Feature/authenticate model update (#30)
* Stub new method for application datastore
Handle command failures more gracefully than continuously retrying. Failures are not logged
Add table for certificates.

(cherry picked from commit 9f580a6)

* Remove methods with signature NewDatastore() from datastores and injection of the logger instance into each datastore because groob is a doodoo head :)
Move NewDatastore methods into unit tests
Reinstate NewDB test
Create certificates package including a Certificate type and a datastore.
Began working on a method ackCertificateList in the connect service.
Boilerplate for management service test.
Renamed some tables in certificates migration, hopefully nobody notices.
Applications response handler should be omitted from this branch.

(cherry picked from commit 8bc2fc7)

* Add device uuid to certificate, as there will never be a normalised form of the certificate data.
Change statments to reflect table change from certificates to devices_certificates
Add the CertificateList request type to the connect service's Acknowledge method
Add certificates datastore to the management service, and add endpoints and request/responses for retrieving certificates by device uuid to the management endpoujnt.
Kludge. commits regarding app service will be amended.
(cherry picked from commit c723c80)

* Don't forget the endpoint definition for certificates!

(cherry picked from commit 4e5fc1f)

* Use byte field for certificate data.

(cherry picked from commit 66d5036)

* Fix empty import in certificates

(cherry picked from commit b6d4dca)

* Add table for certificates.

(cherry picked from commit 06bc231)

* Renamed some tables in certificates migration, hopefully nobody notices.
Rebase develop onto master

(cherry picked from commit 775484d)

* Certificate list responses are saved via replacing the entire certificate list on a per device basis. This is because neither the common name nor the data could be used as a unique constraint in the certificates table.
Few small changes to imports/style.

(cherry picked from commit e0a63e1)

* Properly rollback if certificate insert fails for any certificate in a response.

(cherry picked from commit 99e1ea1)

* Fix several incorrect statements and struct tags which were preventing the certificates management endpoint from listing certs.
Certificate listing is working without a base64 encoded representation of each certificate.

(cherry picked from commit 685dfef)

* Add commands index to command datastore.
Add simple test for commands index
Add commands index endpoint

(cherry picked from commit 4e2a2a2)

* Add handler for GET /mdm/commands

(cherry picked from commit ae71b8f)

* Added Find() method to commands datastore so that the request that matches a response can be retrieved by the connect service.
Added Find() method to command service

(cherry picked from commit ebceb28)

* Fix globally scoped vars in command datastore test suite

* groob prefers inline definition of struct members.

* Uppercase CommandUuid

* Add ackCertificateList to connect service, accidentally omitted from installed_certificate_list PR #14
Make push endpoint conform to Errorer interface.
Wrap error return in management service.
Add missing certsDB in main.go, should have been part of installed_certificate_list PR #14

* Fix erraneous comma in mdmEnrollResponse

* Model is sent with Authenticate message so best to update it there without having to query DeviceInformation.
2016-10-12 11:52:51 +11:00
mosen
8b526c6aaa Add column unlock_token (#19)
Store unlock_token on TokenUpdate message.

(cherry picked from commit bcb16fc)
2016-10-07 10:00:00 +11:00
Mosen
61509d7e75 Handle errors when scanning serial number and udid for insertion when device checks in.
Update udid when device checks in.
2016-06-29 20:09:50 +10:00
Mosen
ee6107b52f Use sql.NullString where possible to allow us to put unique constraints on both UDID and SerialNumber
Remove default of empty string '' from udid column.
2016-06-29 19:01:26 +10:00
Mosen
80eacdbfac Add parameter "separator" to addWhereFilters() 2016-06-26 23:05:34 +10:00
Mosen
9a364d5c86 Use device datastore .Devices() method instead of GetDeviceByUDID.
Query by both device.SerialNumber and device.UDID
join WHERE conditions using the OR logical operator. I can't determine whether this has an impact elsewhere.
2016-06-25 22:19:39 +10:00
Mosen
d69becfd53 Add UDID as a filter to device datastore Devices() so that we can hopefully combine UDID with SerialNumber and abandon GetDeviceByUDID in Acknowledge. 2016-06-25 22:09:53 +10:00
Mosen
79acadd3a2 Fix unique constraint in query fetchDevicesDEP 2016-06-24 14:32:37 +10:00
Mosen
80aedab989 Converting request to mdm.Response was a bad idea. panic.
Update statement to reflect new composite key of udid and serial_number.
2016-06-23 17:33:14 +10:00
Mosen
3da3a3555e Remove unused packages. 2016-06-23 14:09:10 +10:00
Mosen
5f73d44d8e Cast request object to mdm.Response in connect endpoint.
use devices.Save in ackQueryResponses
Remove methods UpdateDeviceQueryResponseByUDID and UpdateDeviceCheckinByUDID
Add message to devices.Save switch block for updating Query Responses.
2016-06-23 14:08:34 +10:00
Mosen
bc3cded620 Add device name to result in devices list.
Fix default and not null constraints on device_name field.
2016-06-22 20:09:52 +10:00
Mosen
68e86c16b4 Devices endpoint reports field last_checkin for each device. 2016-06-22 19:25:00 +10:00
Mosen
4d744fef03 Go fmt
Add fields returned by the management devices endpoint.
2016-06-22 19:13:14 +10:00
Mosen
15b5ec5cef Add service middleware for Connect service to record last_checkin each time a device contacts the MDM
Add method UpdateDeviceCheckinByUDID to device.Datastore which updates the current checkin timestamp for a given device.
Middleware set up in main.go
2016-06-22 19:10:38 +10:00
Mosen
621f5faf02 connect service Acknowledge updates information in devices table for QueryResponses
devices datastore updates QueryResponses into json column `last_query_response`, and some other main attributes into the devices table.
add migration to support column `last_query_response`.
2016-06-22 18:46:16 +10:00
Mosen
6178326b84 Support for devices with IOS <9, changed authenticate query from serial_number to udid. 2016-06-21 23:53:28 +10:00
Mosen
a09ddfca97 Remove unnecessary comments. 2016-06-18 15:21:37 +10:00
Mosen
0633aeafef Remove migrate functions from device/datastore and workflow/datastore
Add migrations into main (very messy indeed)
Fix bizarre glide dependency disappearing.
2016-06-18 15:05:38 +10:00
Victor Vrantchan
6367ee2367 add dep endpoint 2016-05-17 23:42:22 -04:00
Victor Vrantchan
ce131abf52 add push endpoint 2016-05-17 17:37:52 -04:00
Victor Vrantchan
ce0f988b95 clean up checkin service 2016-05-17 12:12:50 -04:00
Victor Vrantchan
405fbdc68e add save method 2016-05-17 10:39:21 -04:00
Victor Vrantchan
4b1d989357 return device by uuid 2016-05-17 08:47:23 -04:00
Victor Vrantchan
7137542840 filter results by UUID 2016-05-17 08:24:23 -04:00
Victor Vrantchan
e6abf1f3c4 update main 2016-05-16 18:25:00 -04:00
Victor Vrantchan
4103418f55 update device datastore 2016-05-16 15:40:41 -04:00
Victor Vrantchan
f9fb514ae4 add profiles to management service 2016-05-12 20:09:44 -04:00
Victor Vrantchan
188cd4237c add management service with fetchDEP endpoint 2016-05-10 10:08:44 -04:00
Victor Vrantchan
4775794483 redo device datastore 2016-05-10 01:06:53 -04:00