Page 1 of 1

Change current user LWEB_JOB iSeries (VL Web)

Posted: Wed Apr 19, 2023 1:12 am
by René Houba
Hi,

I have this issue.

I have a mixed multi tier web environment. Windows web server, data/application server is iSeries.
In the Windows web administrator, you fill in the user that makes the connection to the iSeries (for example DC@PGMLIB).

If a LWEB_JOB now starts on the iSeries, it always run via user DC@PGMLIB. But in the login of the web job, a user has to fill in his iSeries user+password, and via Use Builtin(CHECK_IBMI_SIGNON) I check if that is OK. If OK, I do a #com_owner.StartSession Timeout(3600), but then want to change the current user of the LWEB_JOB into the of the VL Web sign in dialog.

Re: Change current user LWEB_JOB iSeries (VL Web)

Posted: Wed Apr 19, 2023 9:32 am
by BrendanB
Rene,

To change the user associated with a job, you can use a combination of the Get Profile Handle (QSYGETPH) and Set Profile Handle (QWTSETP) APIs.

Since this will require 'saving' the user+password -- you can persist these fields in your server module.

VL does *NOT* guarantee that you get the same LWEB_JOB everytime you make a server module call, so you need to ensure that you do something like:

Code: Select all

srvroutine named(Something) Session(*REQUIRED)
* whatever required input parameters

#com_self.SaveCurrentJobUser
#com_self.ChangeUser(#persistentUser #persistentPassword)

* whatever work is required by this routine

#com_self.RestoreSavedUser
endroutine
This is required, since each call to a server routine could *technically* attach to a different LWEB_JOB (or the same job could be used by *multiple different browsers/users*).

An example of a CL program that changes the user profile can be found at:
https://www.ibm.com/docs/en/i/7.4?topic ... le-handles

B.

Re: Change current user LWEB_JOB iSeries (VL Web)

Posted: Wed Apr 19, 2023 6:28 pm
by René Houba
THANKS Brendan