As far as i have been able to learn by trial and error, the first time a
client connects to the server, it is asigned a User connection ID. This ID
is not related to the 4D user, and will not be the same if you quit and
connect again. As you said, it is more a node connecting to the server. The
good thing is that every process launched by that client has this same User
connection ID. If you develop a way of matching this ID with your [users]
table, you will be able to identify in the server who is playing on the
client side. We do this by launching an special process protected by a
semaphore which creates a record in the [current_users] table filling a
filed with the [users] id, and in the On server close connection method,
another field with the User connection ID. From then on, you just load this
record in the On server open connection (you know the User connection ID)
so you can use it to get the [users] id in triggers.

HTH



Date: Mon, 3 Jul 2017 11:54:28 -0700
> From: Kirk Brooks <[email protected]>
> To: 4D iNug Technical <[email protected]>
> Subject: Re: Triggers and modified by fields in roll-your-own user
>         schemes
> Message-ID:
>         <CAHY=
> [email protected]>
> Content-Type: text/plain; charset="UTF-8"
>
> Joaquin,
> Great suggestion. I'm not going to use it in this case because we don't
> currently have a session tracking system.
>
> But the tip about On server open connection is great. I missed that it
> fires each time a new process begins. I thought it only ran when initially
> connecting to the server.
>
> I really need to go back and re-read some of fundamental commands more
> often.
>
> After playing with this for about 10 minutes I've got a couple of
> questions:
>  the user ID - how does this number correlate to 4D users? Or does it refer
> to 'user' in a more general sense of a 'node' connecting to the server?
>
>  the connection id is some sort of random value I assume but specific to
> this particular process.
>
>
> On Mon, Jul 3, 2017 at 9:14 AM, Joaquin Mendes Castro via 4D_Tech <
> [email protected]> wrote:
>
> > We did this by using the On server open connection and On server close
> > connection database methods. Any process launched by a user session
> shares
> > an ID ($1) which can be used to track who is doing what.
> >
> > When a user logs into the application, we launch an special process which
> > records this UserSession_ID and our internal User_ID in a table
> > ([idsrv_CurrentUsers]). Then, on every new process launched, the On
> server
> > open connection method does a query on this table with the UserSession_ID
> > and loads the user's record as the current for this table. Further on,
> > triggers just have to use the [idsrv_CurrentUsers]User_ID to know who
> shot
> > it.
> >
>
> --
> Kirk Brooks
> San Francisco, CA
> =======================
>
> *The only thing necessary for the triumph of evil is for good men to do
> nothing.*
>
> *- Edmund Burke*
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
>
> ------------------------------
>
> End of 4D_Tech Digest, Vol 122, Issue 4
> ***************************************
>
-- 
*******************************************************************
Joaquín Mendes Castro
ASEMAT, S.A.                                     tlf: 34-91-4015099
Agustina de Aragón 3, Bajo C                     fax: 34-91-4018646
28006 Madrid (SPAIN)               e-mail: [email protected]
*******************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to