project BLF > class ComponentPool > method RegisterClientPrincipalInPool

Description

Enabling auditing on the application database by re-using an existing client principal object (created by mfg/pro).


Parameters


icObjectKeyinputcharacter
oiReturnStatusoutputinteger


Internal usage


BLF
method Activate.MainBlock
method business.ReadSessionValues
method Session.ApplicationLogin
method Session.CheckLogin


program code (program1/componentpool.p)

if oiReturnStatus = 0
then oiReturnStatus = -98.

if icObjectKey = ?
then icObjectKey = "".
else if icObjectKey = "?"
     then icObjectKey = "".
     else if icObjectKey = "INI"
          then icObjectKey = "".

if icObjectKey <> vcClientPrincipalKey
then do:
    if vhClientPrincipalObject <> ?
    then do:
        delete object vhClientPrincipalObject.
        vhClientPrincipalObject = ?.
    end.
    
    if icObjectKey = ""
    or icObjectKey = ?
    then set-db-client(vhDummy).
    else do:
        create client-principal vhClientPrincipalObject.
        vaCPL = base64-decode(icObjectKey).
        vlFcOk = vhClientPrincipalObject:import-principal(vaCPL).
        if vlFcOk
        then if vhClientPrincipalObject:login-state <> "LOGIN"
             then vlFcOk = no.
        if vlFcOk
        then do:
            vhFcComponent = vhPersistenceInPool.
            <M-1 run AuditEnable
               (input  vhClientPrincipalObject (ihClientPrincipal), 
                output viFcReturnSuper (oiReturnStatus)) in persistence>
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then return.
        end.
    end.
    
    vcClientPrincipalKey = icObjectKey.
end.

if oiReturnStatus = -98
then oiReturnStatus = 0.