documentazione_3di_riservata:docway4:script_utili_4
Questa è una vecchia versione del documento!
sanitizerSogin
Lo script è stato realizzato su richiesta del cliente Sogin per aggiungere su tutte le persone interne il diritto di visualizzazione completa sui repertori ET, DSITO, DSGA e il diritto di visualizzare dei documenti riservati per gli archivi xdocwaydoc e xdocwaydoc-nucleco.
- sanitizerSogin.lua
local dbg = require 'xw.dbg' ({active=false, key='acl'}) local xw = require('extraway') xw.addPackage("$.xwTools") ; --[[- --]] function sanitizeACL() -- deactivate triggers xw.triggersOff() ; local outputXML = xw.prepareRecord("<report></report>") ; local outputMainNode = outputXML:selectFirstNode("/report") ; local recordIsModified = false ; local targetRecordSet = xw.executeQuery('([UD,/xw/@UdType/]="persona_interna")') ; if ( targetRecordSet:isValid() and 0 < #targetRecordSet ) then local targetRecord = targetRecordSet:getFirst() ; while ( targetRecord:isValid() ) do recordIsModified = false ; targetRecord_LockResult = targetRecord:lock() ; if ( targetRecord_LockResult == true ) then local targetRecordRootNode = targetRecord:selectFirstNode("/persona_interna", nil) ; local DWETVCompRep = targetRecord:selectFirstNode("/persona_interna/personal_rights/right[@cod='DW-ET-V-CompRep']", nil) ; if ( DWETVCompRep:isValid() ) then if ( DWETVCompRep:getValue() == 'FALSE' ) then DWETVCompRep:setValue('TRUE') ; recordIsModified = true ; end end local DWDSITOVCompRep = targetRecord:selectFirstNode("/persona_interna/personal_rights/right[@cod='DW-DSITO-V-CompRep']", nil) ; if ( DWDSITOVCompRep:isValid() ) then if ( DWDSITOVCompRep:getValue() == 'FALSE' ) then DWDSITOVCompRep:setValue('TRUE') ; recordIsModified = true ; end end local DWDSGAVCompRep = targetRecord:selectFirstNode("/persona_interna/personal_rights/right[@cod='DW-DSGA-V-CompRep']", nil) ; if ( DWDSGAVCompRep:isValid() ) then if ( DWDSGAVCompRep:getValue() == 'FALSE' ) then DWDSGAVCompRep:setValue('TRUE') ; recordIsModified = true ; end end local DWDOCRIS24 = targetRecord:selectFirstNode("/persona_interna/personal_rights/right[@cod='DW-DOC-RIS-24']", nil) ; if ( DWDOCRIS24:isValid() ) then if ( DWDOCRIS24:getValue() == 'FALSE' ) then DWDOCRIS24:setValue('TRUE') ; recordIsModified = true ; end end local DWDOCURIS24 = targetRecord:selectFirstNode("/persona_interna/personal_rights/right[@cod='DW-DOCU-RIS-24']", nil) ; if ( DWDOCURIS24:isValid() ) then if ( DWDOCURIS24:getValue() == 'FALSE' ) then DWDOCURIS24:setValue('TRUE') ; recordIsModified = true ; end end if ( recordIsModified ) then local outcome = targetRecord:save() ; if ( outcome <= 0 ) then targetRecord:unlock() ; xw.log.msg('save error') ; end else targetRecord:unlock() ; end else xw.log.msg('lock error') ; end targetRecord = targetRecordSet:getNext() ; end end -- activate triggers xw.triggersOn() ; return 'true' ; end sanitizer = { sanitizeACL = sanitizeACL, sanitizeACL_signature = { outParms = {"result"} } } ;
/data/attic/documentazione_3di_riservata/docway4/script_utili_4.1505290501.txt.gz · Ultima modifica: 2017/09/13 10:15 da ncandelora