project QadFinancials > class PAuthentication > method KeepAlive

Description

Wrapper for IsAlive.


Parameters


icGlobalSessionIdinputcharacter
ilUpdateSessioninputlogicalupdate session timestamp if still active
olIsActiveoutputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method business.InitInstance
method BTimeOutDaemonProcessor.PerformWorkItem
method Progress.CleanupStateOnline
method Session.IsTimedOut

QadFinancials
method BBaseDaemonProcessor.UpdateSessionTimeStamps


program code (program/pauthentication.p)

/* ================================================================================================ */
/* We first check if sess_mstr is still there and not timeout.                                      */
/* If sess_mstr would not be there or it is timedout, we do not need to run the IsAlive in mfaspl.p */
/* ================================================================================================ */

assign oiReturnStatus = -98.

/* Get sess_mstr */
<Q-3 run SessMstr (all) (Read) (NoCache)
   (input icGlobalSessionId, (GlobalSessionId)
    output dataset tqSessMstr) in BSessionQuery>

find first tqSessMstr where 
           tqSessMstr.tcsess_mfguser = icGlobalSessionId
           no-error.

if not available tqSessMstr
then do :
    assign olIsActive = no
           oiReturnStatus = 0.
    return.
end.

if available tqSessMstr and tqSessMstr.tisess_timeout_min > 0
then do:
    /* Use date and time in UTC */
    session:timezone = 0.
        
    /* TimeIdle = Current Time - LastUsedTime + (1440 minutes per day difference) */
    assign viIdleTimeInMinutes =  ((Today - tqSessMstr.ttsess_date) * 1440) + Round((Time - tqSessMstr.tisess_time) / 60, 0). 

    session:timezone = viTimeOffset.

    /* Session is TimedOut */
    if tqSessMstr.tisess_timeout_min < viIdleTimeInMinutes
    then do:
         assign olIsActive    = no
                oiReturnStatus = 0.
         return.
    end.

end. /* if available tqSessMstr and tqSessMstr.tisess_timeout_min > 0 */

/* We know the sess_mstr still exists and it is not time out.   */
/* If we do not need to update sess_mstr, we have done our work */
if ilUpdateSession = no
then do :
     assign olIsActive     = yes
            oiReturnStatus = 0.
     return.
end.

<ANCESTOR-CODE>