Hi, On Thu, Apr 19, 2007 at 12:40:54PM +0200, Sascha Ottolski wrote: > Hi, > > reading through zope.app.session, I couldn't find any built-in support > for session_start and session_end events, similar to what existed in > Zope2. Are there any recipies for such a use case? Searching the web > didn't gave me pointers. > > And by the way, is it possible to programmatically access the sessions > of other users? If so, how would one do this? Of course I'm well aware > that security issues might arise. > > The use case for both questions would be to find out if a user > is "online", as an information displayed to other users.
There's a persistent object in software space which stores the user session data. However, there's no identification of the user stored in there - except of the login credentials (->only if you use the Session-Credential-Plugin of PAU). You'll have to either assign i.e. the principal id to a user's session data on session creation or be happy with the login name. Example: from zope.app.session.interfaces import ISessionDataContainer from zope.app import zapi def getlogins(): sdc=zapi.getUtility(ISessionDataContainer) sessions=sdc.values() for session in sessions: if 'zope.app.authentication.browserplugins' in session: yield session['zope.app.authentication.browserplugins'].getLogin() (untestet, dangerous, no warranty, ...) Regards, Frank _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users