Source code for q2_sdk.hq.models.audit_details

from typing import Optional
from lxml import objectify


[docs] class AuditDetails: """Audit Details class that is available on self.audit_details in AuditActionHandlers""" audit_id: int """AuditID from the Q2_Audit table""" audit_action: str """Q2_AuditAction.ShortName for the ActionID associated with the Audit event""" start_date_time: str """DateTime of the Start of the Audit event""" workstation: str """Unique Identifier assigned to the device at time of session creation""" ui_source_id: int """UISourceID from the Q2_UISource table. (1 = OLB, 3 = Backoffice, 8 = Q2API)""" session_id: str """OLB SessionId associated with this audit event""" action_id: int """Q2_AuditAction.ID for the Audit event""" details: str | objectify.ObjectifiedElement """LXML ObjectifiedElement of audit event details""" error_return_code: str """Error Return code for the audit event (0 = Success). Error return codes are defined in the Q2_HydraErrorReturnCode table""" client_address: str """IP Address of the caller of HQ (generally Ardent or SDK extensions, not end user IP)""" hq_id: str """ID of HQ instance. Defined in the Q2_HydraIdentity table""" transaction_id: int """(Optional) If a transaction is associated with this event, this will the be ID to the Q2_GeneratedTransaction table.""" customer_id: int """Q2_Customer.CustomerID of Customer that triggered this audit event""" user_id: int """Q2_User.UserID of User that triggered this audit event""" user_logon_id: int """Q2_UserLogon.UserLogonID of Customer that triggered this audit event""" host_account_id: int """(Optional) If a Host Account is associated with this event, this will the be ID to the Q2_HostAccount table.""" end_date_time: int """DateTime of the end of the Audit event""" zone_id: int """ZoneID of the Group that the user who triggered the event is assigned to""" def __init__(self): self.audit_id = 0 self.audit_action = "" self.start_date_time = "" self.workstation = "" self.ui_source_id = 0 self.session_id = "" self.action_id = 0 self.details = "" self.error_return_code = "" self.client_address = "" self.hq_id = "" self.transaction_id = 0 self.customer_id = 0 self.user_id = 0 self.user_logon_id = 0 self.host_account_id = 0 self.end_date_time = 0 self.zone_id = 0 def populate_from_hq( self, audit_details_obj: Optional[objectify.Element] = None ): # pragma: no cover self.audit_id = audit_details_obj.AuditId self.audit_action = audit_details_obj.AuditAction self.start_date_time = audit_details_obj.StartDateTime self.workstation = audit_details_obj.Workstation self.ui_source_id = audit_details_obj.UISourceId self.session_id = audit_details_obj.SessionId self.action_id = audit_details_obj.ActionId if getattr(audit_details_obj, "Details", False): try: self.details = objectify.fromstring( "<root>" + audit_details_obj.Details.text + "</root>" ) except Exception: self.details = audit_details_obj.Details self.error_return_code = audit_details_obj.errorReturnCode self.client_address = audit_details_obj.ClientAddress self.hq_id = audit_details_obj.HqId self.transaction_id = ( audit_details_obj.TransactionId if getattr(audit_details_obj, "TransactionId", False) else None ) self.customer_id = ( audit_details_obj.CustomerId if getattr(audit_details_obj, "CustomerId", False) else None ) self.user_id = ( audit_details_obj.UserId if getattr(audit_details_obj, "UserId", False) else None ) self.user_logon_id = ( audit_details_obj.UserLogonId if getattr(audit_details_obj, "UserLogonId", False) else None ) self.host_account_id = ( audit_details_obj.HostAccountId if getattr(audit_details_obj, "HostAccountId", False) else None ) self.end_date_time = audit_details_obj.EndDateTime self.zone_id = ( audit_details_obj.ZoneId if getattr(audit_details_obj, "ZoneId", False) else None )