pyTenable icon indicating copy to clipboard operation
pyTenable copied to clipboard

Deleting user doesn't have migrate to a user option.

Open PavtheDog opened this issue 4 years ago • 1 comments

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']

PavtheDog avatar Feb 16 '22 01:02 PavtheDog

please feel free to submit a PR.

SteveMcGrath avatar Aug 09 '22 15:08 SteveMcGrath