Hello all! This is my first post. I’m happy to be a part of this community.
I’m trying to do something I expect is very common, but I’m spinning my wheels a little bit. I am using Ignition perspective in v8.1.48 and the current goal is to log various bits of user information each time an operator logs into a perspective project. Most of my experience is with the Vision module. I initially attempted to do this in a startup event, but found this unreliable for my use case.
The trouble I’m running into is that some of the information I am logging is coming into my database as NULL. What I’m attempting to do is fire a change script off of the ‘authenticated’ session property. the following is the execution of this:
def valueChanged(self, previousValue, currentValue, origin, missedEvents): if currentValue.value != previousValue.value and currentValue.value == True:
params = { 'ip_addr' : self.props.address
,'host' : self.props.host
,'userName' : self.props.auth.user.userName
,'userID' : self.props.auth.user.id
,'project' : system.util.getProjectName()
,'timestamp': system.date.now()
}
system.db.runNamedQuery(path = 'Logging/logUserAuth', parameters = params)
What I’m finding is my records only capture the host property, the user id, project name and timestamp. The ip address and username are coming in as NULL, but the same properties are showing up on screen in labels I’ve bound to them. I suspect this might be a timing issue?
I’m using an internal ignition identity provider and user source, in case that matters.
My questions are these:
- Is this the best method for doing something like this? I’m open to alternatives provided they allow me some degree of flexibility with what I am logging.
- Why are my values coming in as NULL? Are the session properties not populated at the same time that the authenticated property is set?
Thanks for your help.