Skip to content

QualysUserProcessor

Ian Glennon edited this page Jun 7, 2023 · 1 revision

QualysUserProcessor module

QualysUserProcessor.convertUser(user: Element, send_email: bool = True, use_prefix: str | None = None, replace_all: str | None = None)

Convert a user from its downloaded XML format to a payload used to create that user in another subscription using createUser()

Parameters:

user:           A document of type xml.etree.Element.ElementTree containing user data
send_email:     If True, follows standard user enrollment workflow.  If False, returns username and

> password in the response.  Defaults to True.

use_prefix:     An optional string value to use as a prefix to Asset Group and Business Unit assignments
replace_all:    A string value containing the name of the Asset Group to substitute for the ‘All’ Asset Group

> in Asset Group assignments to the user

Returns:

payload:        A python dictionary containing the required data to create the user with createUser()

QualysUserProcessor.createUser(target_api: QualysAPI, payload: dict)

Creates a user in a subscription using the payload data generated by convertUser()

Parameters:

target_api:     An object of class QualysAPI
payload:        A python dictionary generated by convertUser() containing user data

Returns:

True            If the API response contains no errors
False           If the API response contains errors

QualysUserProcessor.createUsers(target_api: QualysAPI, urllist: list, send_email: bool = True, simulate: bool = False)

Create users in a subscription from a list of URLs generated by generateURLs()

Parameters:

target_api:         An object of class QualysAPI
urllist:            A list of URLs to submit
send_email:         If True, follows standard user enrollment workflow.  If False, returns the username and

> password for the user in the response.  Defaults to True

simulate:           If True, does not submit the API call to the subscription and outputs the URL to the console

    If False, submits the API call to the subscription
    Defaults to False

Returns:

True                If all users in the userlist were created successfully
False               If any of the users in the userlist were not created successfully, returned at the first

> error

QualysUserProcessor.generateURLs(userlist: Element)

DEPRECATED - USE convertUser() for each user in the userlist data

Generate a list of URLs used to create users based on a list of users obtained with getUsers()

Parameters:

userlist:       A document of type xml.etree.Element.ElementTree containing USER_LIST data obtained with

    getUsers()

Returns:

urllist:        A list of API call URLs to be used to create users

QualysUserProcessor.getUsers(source_api: QualysAPI)

Get a UserList from a subscription

Parameters:

source_api:     An object of class QualysAPI

Returns:

A document of type xml.etree.Element.ElementTree containing the USER_LIST element from the API response

QualysUserProcessor.responseHandler(resp)

Clone this wiki locally