Class: Mdm::Payload
- Inherits:
-
Object
- Object
- Mdm::Payload
- Defined in:
- app/models/mdm/payload.rb
Class Method Summary collapse
- .payload_clear_password(device, request_params) ⇒ Object
- .payload_data_roaming(device, request_params) ⇒ Object
- .payload_device_info(device, request_params = {}) ⇒ Object
- .payload_device_lock(device, request_params = {}) ⇒ Object
- .payload_identify(device, request_params) ⇒ Object
- .payload_install_app(device, request_params) ⇒ Object
- .payload_personal_hotspot(device, request_params) ⇒ Object
- .payload_set_app_settings(device, request_params) ⇒ Object
- .payload_set_wallpaper(device, request_params) ⇒ Object
- .payload_uninstall_app(device, request_params) ⇒ Object
- .payload_voice_roaming(device, request_params) ⇒ Object
Class Method Details
.payload_clear_password(device, request_params) ⇒ Object
62 63 64 65 66 67 68 |
# File 'app/models/mdm/payload.rb', line 62 def self.payload_clear_password(device, request_params) params = request_params.permit(:device_id, :Where) device = Device.find(params[:device_id]) payload('ClearPasscode', params.merge({ UnlockToken: StringIO.new(device.unlock_token) })) end |
.payload_data_roaming(device, request_params) ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'app/models/mdm/payload.rb', line 81 def self.payload_data_roaming(device, request_params) payload('Settings', { Settings: [ { Item: 'DataRoaming', Enabled: request_params.required(:Enabled) == "true" } ] }) end |
.payload_device_info(device, request_params = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/mdm/payload.rb', line 8 def self.payload_device_info(device, request_params = {}) payload('DeviceInformation', { Queries: [ "IsSupervised", "AvailableDeviceCapacity", "BluetoothMAC", "BuildVersion", "CarrierSettingsVersion", "CurrentCarrierNetwork", "CurrentMCC", "CurrentMNC", "DataRoamingEnabled", "DeviceCapacity", "DeviceName", "ICCID", "IMEI", "IsRoaming", "Model", "ModelName", "ModemFirmwareVersion", "OSVersion", "PhoneNumber", "Product", "ProductName", "SIMCarrierNetwork", "SIMMCC", "SIMMNC", "SerialNumber", "UDID", "WiFiMAC", "UDID" ] }) end |
.payload_device_lock(device, request_params = {}) ⇒ Object
4 5 6 |
# File 'app/models/mdm/payload.rb', line 4 def self.payload_device_lock(device, request_params = {}) payload('DeviceLock') end |
.payload_identify(device, request_params) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'app/models/mdm/payload.rb', line 127 def self.payload_identify(device, request_params) params = request_params.permit(:Identifier) payload_set_app_settings( device, ActionController::Parameters.new( { Configuration: { device: { udid: device.udid, serial_number: device.serial_number || 'N/A' } } }.merge(params) ) ) end |
.payload_install_app(device, request_params) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/models/mdm/payload.rb', line 43 def self.payload_install_app(device, request_params) params = request_params.permit( :Options, :ManifestURL, :ManagementFlags, :Configuration, :Attributes, :ChangeManagementState ) payload('InstallApplication', params) end |
.payload_personal_hotspot(device, request_params) ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'app/models/mdm/payload.rb', line 92 def self.payload_personal_hotspot(device, request_params) payload('Settings', { Settings: [ { Item: 'PersonalHotspot', Enabled: request_params.required(:Enabled) == "true" } ] }) end |
.payload_set_app_settings(device, request_params) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 |
# File 'app/models/mdm/payload.rb', line 115 def self.payload_set_app_settings(device, request_params) payload('Settings', { Settings: [ { Item: 'ApplicationConfiguration', Identifier: request_params.require(:Identifier), Configuration: request_params[:Configuration] } ] }) end |
.payload_set_wallpaper(device, request_params) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'app/models/mdm/payload.rb', line 103 def self.payload_set_wallpaper(device, request_params) payload('Settings', { Settings: [ { Item: 'Wallpaper', Image: StringIO.new(request_params.require(:Image).read), Where: request_params[:Where] } ] }) end |
.payload_uninstall_app(device, request_params) ⇒ Object
56 57 58 59 60 |
# File 'app/models/mdm/payload.rb', line 56 def self.payload_uninstall_app(device, request_params) params = request_params.permit(:Identifier) Rails.logger.info "params: #{params.inspect}" payload('RemoveApplication', params) end |
.payload_voice_roaming(device, request_params) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'app/models/mdm/payload.rb', line 70 def self.payload_voice_roaming(device, request_params) payload('Settings', { Settings: [ { Item: 'VoiceRoaming', Enabled: request_params.required(:Enabled) == "true" } ] }) end |