Device approve: bug fixing
@@ -3697,8 +3697,7 @@ class DeviceApproveCommand(EnterpriseCommand):
device_rq.enterpriseUserId = ent_user_id
device_rq.encryptedDeviceToken = base64.urlsafe_b64decode(device['encrypted_device_token'] + '==')
device_rq.denyApproval = True if kwargs.get('deny') else False
- if not kwargs.get('approve'):
- continue
+ if kwargs.get('approve'):
public_key = device['device_public_key']
if not public_key or len(public_key) == 0:
continue
@@ -3738,14 +3737,14 @@ class DeviceApproveCommand(EnterpriseCommand):
logging.warning(rs)
else:
print('')
- headers = ['Email', 'Device ID', 'Device Name', 'Client Version']
+ headers = ['Email', 'Device ID', 'Device Name', 'IP Address', 'Client Version']
rows = []
for k, v in matching_devices.items():
user = next((x for x in params.enterprise['users']
if x.get('enterprise_user_id') == v.get('enterprise_user_id')), None)
if not user:
continue
- rows.append([user.get('username'), k, v.get('device_name'), v.get('client_version')])
+ rows.append([user.get('username'), k, v.get('device_name'), v.get('ip_address'), v.get('client_version')])
rows.sort(key=lambda x: x[0])
dump_report_data(rows, headers)
print('')
