[Building Sakai] check if a given user has active session?

Steve Swinsburg steve.swinsburg at gmail.com
Fri May 14 07:15:48 PDT 2010


Thanks, I was looking for an existing API method or pathway, but I'm currently extending UsageSessionService to add some methods to do what I need (via similar SQL) and will add a patch to a JIRA ticket when I'm done.

cheers,
Steve


On 14/05/2010, at 11:32 PM, Grossman,John E wrote:

> How about
> Select eid, session_server, session_ip
> from sakai_user_id_map a join sakai_session b on a.user_id = b.session_user
> where eid= <the user you'reinterest in> and b.session_active is not null;
> 
> John
> 
> On 5/14/10 5:47 AM, "Stephen Marquard" <stephen.marquard at uct.ac.za> wrote:
> 
>> I think you'd need access to
>> 
>>  /** The sessions - keyed by session id. */
>>        protected Map<String, Session> m_sessions = new
>> ConcurrentHashMap<String, Session>();
>> 
>> in SessionComponent in the kernel, which would let you check the last active
>> time for the user (though rather inefficiently as you'd need to iterate
>> through the map).
>> 
>> So it looks like you'd need to add a new kernel method to get it, and to do it
>> efficiently, alter the implementation. That's only on the current app server
>> though - to do so cluster-wide you'd need to check the user presence which
>> could be done more efficiently involving a db query. Then there are the
>> various issues about how presence is set and times out which could affect the
>> accuracy of the result (more accurate in 2.7 than 2.6).
>> 
>> Cheers
>> Stephen
>> 
>>>>> Steve Swinsburg <steve.swinsburg at gmail.com> 5/14/2010 12:30 PM >>>
>> Hi all,
>> 
>> Is it possible to check if a given user has an active session? Essentially I'd
>> like to know if a user is 'online'.
>> 
>> SessionManager doesn't seem to be able to check any given user, only the
>> current user, or check a Session that you already know about, but I'd need to
>> be able to get the current Session(s) that a user might have first.
>> 
>> cheers,
>> Steve
>> 
>> 
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> 
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
>> with a subject of "unsubscribe"
>> 
>> 
>> 
>> ______________________________________________________________________________
>> ________________ 
>> 
>> UNIVERSITY OF CAPE TOWN
>> 
>> This e-mail is subject to the UCT ICT policies and e-mail disclaimer published
>> on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or
>> obtainable from +27 21 650 4500. This e-mail is intended only for the
>> person(s) to whom it is addressed. If the e-mail has reached you in error,
>> please notify the author. If you are not the intended recipient of the e-mail
>> you may not use, disclose, copy, redirect or print the content. If this e-mail
>> is not related to the business of UCT it is sent by the sender in the sender's
>> individual capacity.
>> 
>> ______________________________________________________________________________
>> _______________________
>> 
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> 
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
>> with a subject of "unsubscribe"
> 



More information about the sakai-dev mailing list