Restful Authentication - which users are logged in


I'm using Restful Authentication plugin to provide credentials to users
to my service.

I'd like to be able to list which users are logged into the system. What
would be the best approach.

At least in the sessions controller I could add a flag for each user
when they come and go but that means DB action and I'm not sure if
that's the proper way.

I found this also:

But I'd like to know your opinion about the best way.


Hi again,

I've been checking more about sessions and all that. I haven't checked
every single detail of all possible ways but I think that cokies can be
used, activeRecordStore, etc.

As said I'm using Restful authentication and that goes with cockies. Ok
with me so far.

I've added a column to my users to store their status. I update it when
they come and go. But of course users don't logout when the close their
browsers. So I would register some actions when users browse the site,
i.e. record the timestamps.

After doing that I would use a script runner to see if the last activity
was for example 30 minutes ago, if so then I would update their status
to logged out.

Do you think that makes sense?

Hi, I also found another tutorial where basically was updating a status
flag for each user.

In that direction (storing each user’s last_visit time in the User model) :

remark: it only counts the logged-in users.

Great so that's another example. Thanks.

In the end I actually decided to use active record store and it is going
pretty well. But I have some questions about and I'll start a new topic
about sessions cleanup and avoiding duplication.