pyTenable
pyTenable copied to clipboard
Deleting user doesn't have migrate to a user option.
sc -> users.py -> delete doesn't allow the option to transfer a user's objects to another user. I made the following changes to my code:
def delete(self, id, migrate_id = None):
'''
Removes a user.
:sc-api:`user: delete <User.html#user_id_DELETE>`
Args:
id (int): The numeric identifier for the user to remove.
migrate_id (int): The numeric identifier for the user to move objects too.
Returns:
:obj:`str`:
An empty response.
Examples:
>>> sc.users.delete(1)
'''
payload={}
if not migrate_id is None:
payload = {'migrateUserID':migrate_id}
print (payload)
return self._api.delete('user/{}'.format(
self._check('id', id, int)), json=payload).json()['response']
please feel free to submit a PR.