Hi all,
is it possible to get/restore a session by the session_id in a
controller action?
I’m using a flash component (MultiPowUpload) which unfortunately doesn’t
pass cookies when calling an action. Therefore I have coded the
session_id into the called URL.
Now in the controller action I receive the session_id as a param and
want to check whether there is a corresponding session and read the user
data.
Is there a way to do this??
Thanx,
Starburger
yes when you are implementing session then you can fetch the session id
using session[:user] and compare it with the user id
On 1 Nov 2007, at 11:02, Star B. wrote:
Now in the controller action I receive the session_id as a param and
want to check whether there is a corresponding session and read the
user
data.
Is there a way to do this??
Rails can do it for you, however it’s been turned off recently. I
forget the exact details, but it can definitely be done.
Fred
Hello Starburger,
I had a session cleaner that would look into session data before doing
stuff. It worked like this:
CGI::Session::ActiveRecordStore::Session.find(:all, :conditions =>
[‘updated_at < ?’, cond]).each do |s|
dataHash =
CGI::Session::ActiveRecordStore::Session.unmarshal(s[:data])
#
User.find(dataHash[:rbac_user_id]).change_online_status(User::Offline)
if dataHash[:rbac_user_id]
@counter += 1
end
So I was using this to check dead sessions out but it should work for
you. If you have the session_id you should be able to
s = CGI::Session::ActiveRecordStore::Session.find(params[session_id])
dataHash =
CGI::Session::ActiveRecordStore::Session.unmarshal(s[:data])
and then dataHash[:whatever_you_got_in_there]
Hope this helps.
I have a selfish motive here, I was wondering if you got this
working. I’m looking to using the MultiPowUpload thing and need to
know how to catch the file uploads.
Mike
[email protected]
On Nov 1, 3:02 am, Star B. [email protected]
Dhaval P. wrote:
yes when you are implementing session then you can fetch the session id
using session[:user] and compare it with the user id
The problem is, that the call doesn’t pass the session cookie - so there
simply is no session object to compare. The only thing which is passed
is the session_id as a parameter.
So I need to access the session object based on the session_id.