Need advice on handling system.security.switchUser refreshing window during a step process

Using Ignition 8.1.48.

I have a popup window that is made to act like a step wizard. It has 5 steps, each step is a container named like 0 LOGIN 1 BLAH 2 FOO5 LOGON

The root container has properties

initialStep= expression - static value of 0 so I don’t accidentally leave designer in a bad spot

step = property binding to initialStep so it starts at 0 Login and but as they proceed this gets incremened to 1.

The issue I am facing here is that this vision program has an auto login user. When they do a process like this, it requires them in step 0 to do a login to a user with permissions and this will eventually get recorded to the db for this process. This is fine as the window reopens and and we are still on the same window so the operator can click next and nothing looks different except the next button is enabled as expcted.

The real issue comes at step 5 when they click on the login button again to record who is doing this bit. Then the whole window refreshes, step goes back to 0, all previous step information is lost, and instead of the finish button being highlighted the next button is because we are now logged in and at step 0

I don’t see anyway around this at the moment. The only way I can sort of think to do this is on the second login bit in step 5 i do a validateUser vs switchUser but then I could potentially login there with a different user with permissions which is allowed and expected, that isn’t reflected in my docked header that has a bit that aways shows the logged in user, and then that bit is confusing too.

Just looking for some advice on how to handle this, if anyones run into and resolved this sort of scenario before. I have no idea on how to tackle this at the moment.

I know in the other version of the project (which I am remaking here) they always used validateUser and rolled their own roles permissions for everything and I would like to avoid that.

You might could cache your process state with some sort of identifier along with the current state outside of the window, database or otherwise.

Any time the window loads with the passed id, it knows what the current state is.

EDIT: username might be the best identifier to store the state with.

One issue is that the username could legitimately change - one user starts the proccess and another finishes it.

1 Like

I think right now my best bet is trying to convince them to make the “finish” button trigger the last login before closing the window and avoid the headache of caching and repopulating the window upon re-open.

In place of the login button on step 5, could you have the actual controls on the window there?

Username: Password: Then do a validate on the entered values and proceed/halt based off of that?

1 Like

Yea I am looking int that. I think the user is supposed to be logged out back to the auto login anyways after this, in which case I don’t mind do a validate user then business logic then logout and then the header usrename is never really “wrong” for any significant amount of time.

After the process/popup ends the user is supposed to be logged out anyways so I was able to get away with a

  1. validate user
  2. Run business logic
  3. Switch back to autologged in user

One little thing i did run into worth mentioning probably is I had a

system.nav.closeParentWindow(event)
User.logout() #My library func to swtich to auto user

Running this actually reopened the window. I needed to wrap use User.logout with a system.util.invokeLater to ensure the popup closed and then the user logged out.

Thanks everyone.