project BLF > class Database Component > method ReadObjectSecurity

Description

Returns object security on currently loaded (with DataLoad) object


Parameters


tSelectedActivitiesoutputtemp-table
tSelectedUsersoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/database.p)

if oiReturnStatus = 0
then oiReturnStatus = -98.

<M-1 run DataDescription
   (input  '' (icRowids), 
    input  '' (icPkey), 
    input  '' (icObjectIds), 
    input  no (ilAllTables), 
    output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

find first tFcDynRel where tFcDynRel.tcFcFrom = "" no-error.
if available tFcDynRel
then do:
    create query vhQuery in widget-pool "non-persistent".
    vhQuery:forward-only = yes.
    vhQuery:set-buffers(tFcDynRel.thFcBuffer).
    assign vlFcOk = vhQuery:query-prepare ("for each ":U + tFcDynRel.thFcBuffer:name).
    if vlFcOk
    then assign vlFcOk = vhQuery:query-open().
    if vlFcOk
    then do:
        vhQuery:get-first().
        vlFcOk = not vhQuery:query-off-end.
    end.
    if not vlFcOk
    then do:
        vhQuery:query-close().
        delete object vhQuery.
        assign oiReturnStatus = -3.
        <M-2 run SetMessage (input  'No data is available.':U (icMessage), 
                         input  '' (icArguments), 
                         input  '' (icFieldName), 
                         input  '' (icFieldValue), 
                         input  'S':U (icType), 
                         input  3 (iiSeverity), 
                         input  '' (icRowid), 
                         input  'BLF-313':U (icFcMsgNumber), 
                         input  '' (icFcExplanation), 
                         input  '' (icFcIdentification), 
                         input  '' (icFcContext), 
                         output viFcReturnSuper (oiReturnStatus)) in database>
        return.
    end.
    
    <M-3 run GetPKValues (input  tFcDynRel.thFcBuffer (ihBuffer), 
                          output vcObjectSecurityLoaded (ocPKValue), 
                          output viFcReturnSuper (oiReturnStatus)) in database>
    
    vhQuery:get-next().
    vlFcOk = vhQuery:query-off-end.
    vhQuery:query-close().
    delete object vhQuery.
    
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.
    
    if not vlFcOk
    then do:
        assign oiReturnStatus = -3.
        <M-5 run SetMessage (input  'Only one database object should be loaded.':U (icMessage), 
                         input  '' (icArguments), 
                         input  '' (icFieldName), 
                         input  '' (icFieldValue), 
                         input  'S':U (icType), 
                         input  3 (iiSeverity), 
                         input  '' (icRowid), 
                         input  'BLF-314':U (icFcMsgNumber), 
                         input  '' (icFcExplanation), 
                         input  '' (icFcIdentification), 
                         input  '' (icFcContext), 
                         output viFcReturnSuper (oiReturnStatus)) in database>
        return.
    end.
    
    <I-11 {bFcAddToTransaction
         &CLASS           = "BObjectSecurity"}>
    
    <M-9 run DataLoadObjectSecurity (input  vcFcComponentName (icBusinessComponentName), 
                                     input  vcObjectSecurityLoaded (icObjectReference), 
                                     output tSelectedActivities (tSelectedActivities), 
                                     output tSelectedUsers (tSelectedUsers), 
                                     output viFcReturnSuper (oiReturnStatus)) in BObjectSecurity>
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then do:
        <I-10 {bFcCloseAndStopInstance
            &CLASS           = "BObjectSecurity"}>
        return.
    end.
    
    <I-8 {bFcCloseInstance
            &CLASS           = "BObjectSecurity"}>
end.

if oiReturnStatus = -98
then oiReturnStatus = 0.