So I started looking into trying to get this to work and I'm stuck, mainly
because web2py storing sessions in Redis is a blackbox to me. I couldn't
find anywhere in the documentation how to query the session db. I'm
storing my sessions in redis following the code snippet in the deployment
recipes.
I'm able to find all the IPs the user has logged in within the last 24
hours:
from datetime import date, timedelta
d_window = date.today()-timedelta(days=1)
events = eval('db((db.auth_event.user_id == auth.user_id) &
(db.auth_event.time_stamp > d_window) & (db.auth_event.description == "User
%d Logged-in")).select()' % (auth.user_id))
iplist = {};
for event in events:
iplist[event.client_ip] = 1
But now i'm not sure how to query redis to find the sessions for those IPs,
link them to the user, check for auth objects, and delete the ones i need
to. Any pointers in the right direction would be appreciated. As always
thanks for the help.
Dean
On Monday, February 10, 2014 4:55:15 PM UTC-5, Anthony wrote:
>
> Speaking as a naive developer, the "cpu/io intensive" remark suggests to
>> me that the onlogin hook be used to queue a job for a worker thread that
>> would carry out the hunt-and-flush mission. Or would that be the wrong
>> hammer for this torque screw?
>>
>
> Sounds reasonable, though I would test to see how long it takes to
> determine if that's really necessary.
>
> Anthony
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.