Consultor Eletrônico



Kbase P22532: How to know the userid of a client connected to an AppServer?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Verified

GOAL:

How to know the userid of a client connected to an AppServer?

GOAL:

How do I record the userid of a client session connected to AppServer?

GOAL:

What code can I implement to record a client id connected to AppServer?

GOAL:

Can a specific client session (userID or node) be identified via the 9.x Progress AppServer log files or any other method?

FACT(s) (Environment):

Progress 9.x

FIX:

There is no direct way of knowing that.

One example of how that can be achieved via the 4GL is that the userid of a client be passed as a parameter to the AppServer in the CONNECT() method, and then the AppServer' Connect procedure stores that information in the SESSION:SERVER-CONNECTION-CONTEXT.

In order to accomplish that, you'll have to write a Connect procedure along these lines:
/* connect.p. */
DEFINE INPUT PARAMETER pcUserid AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcPassword AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcInfo AS CHARACTER NO-UNDO.

ASSIGN SESSION:SERVER-CONNECTION-CONTEXT = pcUserid.
Then, you have to setup this connect.p as your AppServer Connect procedure. You can do that in either of two ways:
a) Progress Explorer:
Open the AppServer Properties, go to Server -> Advanced features, type the Connect procedure name in the field labeled 'Connect'.
b) By hand-editing the ubroker.properties file and adding the 'srvrConnectProc' parameter in the section related to your AppServer.

On the client side you can have something like the following:

DEFINE VARIABLE hServer AS HANDLE NO-UNDO.

CREATE SERVER hServer.
hServer:CONNECT("-H myhost -AppService asbroker1", "myUserid", "", "").
The second, third and fourth parameters in the CONNECT() method are passed as the first, second and third input parameters in your Connect procedure on the AppServer respectively.

The final result is that "myUserid" will be stored in SESSION:SERVER-CONNECTION-CONTEXT on the AppServer side. Other programs on the AppServer side can read SESSION:SERVER-CONNECTION-CONTEXT to retrieve the userid of the user connected to the AppServer.