#1 2012-01-25 12:37:59

lele9
Member
Registered: 2011-10-28
Posts: 170

last access of users

how can i see last access timestamp of each user?

Offline

#2 2012-01-25 13:32:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: last access of users

Search in the TAuthSession.User property of TSQLRestServer.fSessions[] array: the last access time stamp is stored in LastAccess property.

Please note that access to the fSessions[] array is protected by a fSessionCriticalSection lock.

See some code for safe access to fSessions[] array in TSQLRestServer.SessionGetUser() method.

Offline

#3 2012-01-25 15:42:28

lele9
Member
Registered: 2011-10-28
Posts: 170

Re: last access of users

yes i know session but with this i can have just the user logged in, instead i want to know the last access of all user. it's possible?

Offline

#4 2012-01-25 16:13:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: last access of users

No, it is not possible by default, since there is no such data stored within the database.
The only data available is in the TAuthSession in-memory tables.

You will have to save it in the database, e.g. in a dedicated audit-trail table (like in the MainDemo).
Or you may use the TSQLAuthUser.Data blob field to store some data within (e.g. via a RecordSave), and set the latest accessed date and time (and IP, or other).

Offline

#5 2012-01-25 16:47:57

lele9
Member
Registered: 2011-10-28
Posts: 170

Re: last access of users

i understand.
i think there is an easy way to do but its ok, when i have time to try i post my solution for other user.
thanks a lot.
Emanuele.

Offline

#6 2012-03-05 10:28:17

lestat
Member
From: Italy
Registered: 2012-02-20
Posts: 11

Re: last access of users

How can i convert the last access property in date and time?

Tanks

Offline

#7 2012-03-05 13:09:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: last access of users

This is an Iso8601 encoded property, i.e. a Int64 which can be mapped into a Iso8601 object.

See the documentation about this type.

You can use Iso8601(aTimeProperty).ToDateTime e.g.

Offline

#8 2012-03-07 13:39:47

lestat
Member
From: Italy
Registered: 2012-02-20
Posts: 11

Re: last access of users

Thanks ab.

it works with iso8601now but with last access it returns an error.
for example  lastaccess is 19775435, and iso86now is 135032268700

Offline

#9 2012-03-07 14:23:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: last access of users

I'm sorry, I did not check the source code earlier.
So my answer above was incorrect. sad

lastaccess is NOT an Iso8601 timestamp.
This is a cardinal value retrieved from GetTickCount. GetTickCount is much faster than the TDateTime equivalency.
There is no easy way of converting it into a time stamp.
Purpose of LastAccess was not to be retrieved directly, but to handle session timeouts.

Offline

#10 2012-03-07 15:10:12

lestat
Member
From: Italy
Registered: 2012-02-20
Posts: 11

Re: last access of users

Thanks for your answer ab

Offline

Board footer

Powered by FluxBB