Class: AppPermissionStatistics::MobileProvision
- Inherits:
-
Object
- Object
- AppPermissionStatistics::MobileProvision
show all
- Defined in:
- lib/app_permission_statistics/mobile_provision.rb
Overview
.mobileprovision file parser
Defined Under Namespace
Classes: DeveloperCertificate
Instance Method Summary
collapse
Constructor Details
Returns a new instance of MobileProvision.
13
14
15
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 13
def initialize(path)
@path = path
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
271
272
273
274
275
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 271
def method_missing(method_name, *args, &block)
mobileprovision.try(:[], method_name.to_s.ai_camelcase) ||
mobileprovision.send(method_name) ||
super
end
|
Instance Method Details
252
253
254
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 252
def [](key)
mobileprovision.try(:[], key.to_s)
end
|
#adhoc? ⇒ Boolean
110
111
112
113
114
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 110
def adhoc?
return false if platform == :macos
!development? && !devices.nil?
end
|
21
22
23
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 21
def app_name
mobileprovision.try(:[], 'AppIDName')
end
|
#appstore? ⇒ Boolean
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 99
def appstore?
case platform.downcase.to_sym
when :ios
!development? && entitlements.key?('beta-reports-active')
when :macos
!development?
else
raise Error, "Not implement with platform: #{platform}"
end
end
|
#created_date ⇒ Object
61
62
63
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 61
def created_date
mobileprovision.try(:[], 'CreationDate')
end
|
#developer_certs ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 73
def developer_certs
certs = mobileprovision.try(:[], 'DeveloperCertificates')
return if certs.empty?
certs.each_with_object([]) do |cert, obj|
obj << DeveloperCertificate.new(cert)
end
end
|
#development? ⇒ Boolean
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 85
def development?
case platform.downcase.to_sym
when :ios
entitlements['get-task-allow'] == true
when :macos
!devices.nil?
else
raise Error, "Not implement with platform: #{platform}"
end
end
|
45
46
47
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 45
def devices
mobileprovision.try(:[], 'ProvisionedDevices')
end
|
#empty? ⇒ Boolean
256
257
258
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 256
def empty?
mobileprovision.nil?
end
|
#enabled_capabilities ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 126
def enabled_capabilities
capabilities = Hash.new
entitlements.each do |key, value|
case key
when 'com.apple.developer.game-center'
capabilities['Game Center'] = {
key => value
}
when 'keychain-access-groups'
capabilities['Keychain sharing'] = {
key => value
}
when 'aps-environment'
capabilities['Push Notifications'] = {
key => value
}
when 'com.apple.developer.applesignin'
capabilities['Sign In with Apple'] = {
key => value
}
when 'com.apple.developer.siri'
capabilities['SiriKit'] = {
key => value
}
when 'com.apple.security.application-groups'
capabilities['App Groups'] = {
key => value
}
when 'com.apple.developer.associated-domains'
capabilities['Associated Domains'] = {
key => value
}
when 'com.apple.developer.default-data-protection'
capabilities['Data Protection'] = {
key => value
}
when 'com.apple.developer.networking.networkextension'
capabilities ['Network Extensions'] = {
key => value
}
when 'com.apple.developer.networking.vpn.api'
capabilities ['Personal VPN'] = {
key => value
}
when 'com.apple.developer.healthkit',
'com.apple.developer.healthkit.access'
capabilities['HealthKit'] = {
'com.apple.developer.healthkit' => entitlements['com.apple.developer.healthkit'],
'com.apple.developer.healthkit.access' => entitlements['com.apple.developer.healthkit.access'],
} unless capabilities.include?('HealthKit')
when 'com.apple.developer.icloud-services',
'com.apple.developer.icloud-container-identifiers'
capabilities['iCloud'] = {
'com.apple.developer.icloud-services' => entitlements['com.apple.developer.icloud-services'],
'com.apple.developer.icloud-container-identifiers' => entitlements['com.apple.developer.icloud-container-identifiers'],
} unless capabilities.include?('iCloud')
when 'com.apple.developer.in-app-payments'
capabilities['Apple Pay'] = {
key => value
}
when 'com.apple.developer.homekit'
capabilities['HomeKit'] = {
key => value
}
when 'com.apple.developer.user-fonts'
capabilities['Fonts'] = {
key => value
}
when 'com.apple.developer.pass-type-identifiers'
capabilities['Wallet'] = {
key => value
}
when 'inter-app-audio'
capabilities['Inter-App Audio'] = {
key => value
}
when 'com.apple.developer.networking.multipath'
capabilities['Multipath'] = {
key => value
}
when 'com.apple.developer.authentication-services.autofill-credential-provider'
capabilities['AutoFill Credential Provider'] = {
key => value
}
when 'com.apple.developer.networking.wifi-info'
capabilities['Access WiFi Information'] = {
key => value
}
when 'com.apple.external-accessory.wireless-configuration'
capabilities['Wireless Accessory Configuration'] = {
key => value
}
when 'com.apple.developer.kernel.extended-virtual-addressing'
capabilities['Extended Virtual Address Space'] = {
key => value
}
when 'com.apple.developer.nfc.readersession.formats'
capabilities['NFC Tag Reading'] = {
key => value
}
when 'com.apple.developer.ClassKit-environment'
capabilities['ClassKit'] = {
key => value
}
when 'com.apple.developer.networking.HotspotConfiguration'
capabilities['Hotspot'] = {
key => value
}
when 'com.apple.developer.devicecheck.appattest-environment'
capabilities['App Attest'] = {
key => value
}
when 'com.apple.developer.coremedia.hls.low-latency'
capabilities['Low Latency HLS'] = {
key => value
}
when 'com.apple.developer.associated-domains.mdm-managed'
capabilities['MDM Managed Associated Domains'] = {
key => value
}
end
end
capabilities
end
|
#enterprise? ⇒ Boolean
Also known as:
inhouse?
116
117
118
119
120
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 116
def enterprise?
return false if platform == :macos
!development? && !adhoc? && !appstore?
end
|
#entitlements ⇒ Object
69
70
71
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 69
def entitlements
mobileprovision.try(:[], 'Entitlements')
end
|
#expired_date ⇒ Object
65
66
67
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 65
def expired_date
mobileprovision.try(:[], 'ExpirationDate')
end
|
#mobileprovision ⇒ Object
260
261
262
263
264
265
266
267
268
269
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 260
def mobileprovision
return @mobileprovision = nil unless File.exist?(@path)
data = File.read(@path)
data = strip_plist_wrapper(data) unless bplist?(data)
list = CFPropertyList::List.new(data: data).value
@mobileprovision = CFPropertyList.native_types(list)
rescue CFFormatError
@mobileprovision = nil
end
|
17
18
19
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 17
def name
mobileprovision.try(:[], 'Name')
end
|
41
42
43
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 41
def platform
platforms[0]
end
|
32
33
34
35
36
37
38
39
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 32
def platforms
return unless platforms = mobileprovision.try(:[], 'Platform')
platforms.map do |v|
v = 'macOS' if v == 'OSX'
v.downcase.to_sym
end
end
|
#profile_name ⇒ Object
57
58
59
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 57
def profile_name
mobileprovision.try(:[], 'Name')
end
|
#respond_to_missing?(method_name, *args) ⇒ Boolean
277
278
279
280
281
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 277
def respond_to_missing?(method_name, *args)
mobileprovision.key?(method_name.to_s.ai_camelcase) ||
mobileprovision.respond_to?(method_name) ||
super
end
|
#team_identifier ⇒ Object
49
50
51
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 49
def team_identifier
mobileprovision.try(:[], 'TeamIdentifier')
end
|
#team_name ⇒ Object
53
54
55
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 53
def team_name
mobileprovision.try(:[], 'TeamName')
end
|
25
26
27
28
29
30
|
# File 'lib/app_permission_statistics/mobile_provision.rb', line 25
def type
return :development if development?
return :adhoc if adhoc?
return :appstore if appstore?
return :enterprise if enterprise?
end
|