Well, it's been about two weeks since I was able to get to this; but here's my function for getting session data on an OpenBD user - outside that user's own web request (like an event or Flex remote object call).

I welcome suggestions on making this more efficient before I post it. ("Occam razor, Jacob's Ladder, Skinner's box", whatever we call that process...) All I did was incorporate the sessionTracker replacement that Matt whipped up.

Pass in the Application name and target user's sessionId:

<cffunction name="getCFSessionByID" returntype="struct" access="public" hint="Pulls a session scope - as a structure - from the OpenBD platform">
    <cfargument name="appName" type="string" required="true" hint="ColdFusion application name, set in Application.cfc or Application.cfm ">
    <cfargument name="userSessionId" type="string" required="true" hint="ColdFusion sessionid, provided onSessionStart to users by the application.">
    <cfset var sessionCF = structNew()>
    <cfset var allAppSessions = structNew()>
    <cfset var returnStru = structNew()>
    <cfset returnStru.success = 0>

    <cfset sessionCF = CreateObject('java','com.naryx.tagfusion.cfm.engine.cfSession').init(getPageContext().getRequest(), getPageContext().getResponse(), getPageContext().getServletContext()) />
    <cfset allAppSessions = CreateObject('java','com.naryx.tagfusion.cfm.application.cfApplicationManager').getAppData(sessionCF,arguments.appName).getSessions()>

    <cfloop collection="#allAppSessions#" item="oneAppSession">
        <cfif allAppSessions[oneAppSession].sessionid eq arguments.userSessionId>
            <cfset returnStru.session = allAppSessions[oneAppSession]>
            <cfset returnStru.success = 1>
        </cfif>
    </cfloop>

    <cfreturn returnStru>
</cffunction>

--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
official manual: http://www.openbluedragon.org/manual/
Ready2Run CFML http://www.openbluedragon.org/openbdjam/
 
mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to