On Monday, 18 February 2013 17:28:27 UTC+7, Jeremy Burns wrote:
I want to be sure that a user account is only in use by a single user at any one time. My thought was to add a user_id column to the cake_sessions table, then on log in check to see if the current user's id is stored against any records that don't match the current session id. I delete all those records which effectively logs any other user's logged in with 'this' account. I then store the current user's id against the current session.I had this working in 1.3 by using $Session = ClassRegistry::getObject(Configure::read('Session. model')); and then using the $Session object to query, delete and update records. It fails in 2.3. I have tried to create a new model with $useTable = 'cake_sessions' but doing a find of any type returns an empty array. Is anyone else doing anything similar or has any pointers please?
I was doing something similar using redis session store but then converted to db store https://github.com/xintesa/DbSession/blob/master/Model/Datasource/Session/DbSession.php
Note: it uses an extra table cake_user_sessions.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment