Produced by Araxis Merge on 10/4/2017 8:04:36 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\production\rdk\src\subsystems\pep | pep-handler-patient-access-policy.js | Fri Aug 25 15:36:55 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\subsystems\pep | pep-handler-patient-access-policy.js | Tue Oct 3 17:18:38 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 242 |
| Changed | 1 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | var async = require( 'async'); | |
| 3 | var rdk = require('. ./../core/ rdk'); | |
| 4 | var httpUt il = rdk.u tils.http; | |
| 5 | var sensit ivityUtils = rdk.uti ls.sensiti vity; | |
| 6 | var _ = re quire('lod ash'); | |
| 7 | var rulesE ngine = re quire('../ pdp/rules- engine'); | |
| 8 | var rules = require( '../pdp/pa tient-acce ss-policy- rules').ru les; | |
| 9 | var userPo licyBuilde r = requir e('./user- policy-bui lder'); | |
| 10 | ||
| 11 | function g etPatient( obj, patie ntCallback ) { | |
| 12 | var pi d = obj.pi d || _.res ult(obj, ' intercepto rResults.p atientIden tifiers.or iginalID', ''); | |
| 13 | if (_. isEmpty(pi d)) { | |
| 14 | ob j.logger.w arn('No pa tient coul d be ident ified to a uthorize a gainst.'); | |
| 15 | re turn setIm mediate(pa tientCallb ack, { | |
| 16 | message: 'PEP: Una ble to pro cess reque st. Pid no t found.', | |
| 17 | code: rd k.httpstat us.forbidd en | |
| 18 | }) ; | |
| 19 | } | |
| 20 | var bu ildPatient PolicyData = functio n(err, res ponse, pat ients) { | |
| 21 | if (err) { | |
| 22 | return p atientCall back({ | |
| 23 | mess age: 'PEP: Unable to process r equest.', | |
| 24 | code : rdk.http status.int ernal_serv er_error | |
| 25 | }); | |
| 26 | } | |
| 27 | if (!_.isObj ect(patien ts)) { | |
| 28 | return p atientCall back({ | |
| 29 | mess age: 'PEP: Unable to process r equest. Pa rser error .', | |
| 30 | code : rdk.http status.int ernal_serv er_error | |
| 31 | }); | |
| 32 | } | |
| 33 | re turn patie ntCallback (null, pat ients); | |
| 34 | }; | |
| 35 | // Tri gger the J DS fetch a nd run the check for sensitive data on a patient a nd finally run the p ep paths c an be as f ollows: | |
| 36 | // http:// IP /data/inde x/pt-selec t-icn/?ran ge=5123456 789V027402 | |
| 37 | // http:// IP /data/inde x/pt-selec t-pid/?ran ge=9E7A;18 | |
| 38 | var ht tpConfig = { | |
| 39 | ti meout: 500 0, | |
| 40 | lo gger: obj. logger, | |
| 41 | ba seUrl: obj .app.confi g.jdsServe r.baseUrl, | |
| 42 | js on: true, | |
| 43 | ur l: '/data/ index/pt-s elect-' + (_.contain s(pid, ';' ) ? 'pid' : 'icn') + '?range=' + pid | |
| 44 | }; | |
| 45 | httpUt il.get(htt pConfig, b uildPatien tPolicyDat a); | |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * Handler used to d etermine i f the sess ion user h as the nee ded access for the c urrent req uest. | |
| 50 | * | |
| 51 | * @param req current re quest that contain u ser sessio n | |
| 52 | * @param res response | |
| 53 | * @param callback final proc essing cal lback | |
| 54 | */ | |
| 55 | module.exp orts = fun ction(req, res, call back) { | |
| 56 | req.au dit.sensit ive = 'fal se'; | |
| 57 | getPat ient(req, function(e rr, result ) { | |
| 58 | if (err) { | |
| 59 | return c allback(er r); | |
| 60 | } | |
| 61 | va r userPati entAccessP ermission = userPoli cyBuilder( req, resul t); | |
| 62 | us erPatientA ccessPermi ssion.reso urceConfig ItemRel = _.result(r eq, '_reso urceConfig Item.rel', ''); | |
| 63 | us erPatientA ccessPermi ssion.pati entPid = r eq.pid || _.result(r eq, 'inter ceptorResu lts.patien tIdentifie rs.origina lID', ''); | |
| 64 | us erPatientA ccessPermi ssion.isPa tientCentr ic = _.res ult(req, ' _resourceC onfigItem. isPatientC entric', f alse); | |
| 65 | ru lesEngine. executeRul es(rules, userPatien tAccessPer mission, f unction(re sults) { | |
| 66 | req.logg er.debug(' PEP Patien t Access: ' + result s.code + ' pep respo nse receiv ed.'); | |
| 67 | if (resu lts.code = == 'Permit ') { | |
| 68 | retu rn callbac k(null, re sults); | |
| 69 | } else i f (results .code === 'BreakGlas s') { | |
| 70 | res. header('BT G', result s.reason); | |
| 71 | retu rn callbac k({ | |
| 72 | message: r esults.tex t, | |
| 73 | code: rdk. httpstatus .permanent _redirect | |
| 74 | }, n ull); | |
| 75 | } else { | |
| 76 | retu rn callbac k({ | |
| 77 | message: r esults.tex t, | |
| 78 | code: rdk. httpstatus .forbidden | |
| 79 | }, n ull); | |
| 80 | } | |
| 81 | }) ; | |
| 82 | }); | |
| 83 | }; | |
| 84 | module.exp orts.maskS ensitive = function( obj, callb ack) { | |
| 85 | if (!( obj.items && obj.log ger && obj .app && ob j.audit)) { | |
| 86 | va r error = 'Missing r equired da ta.'; | |
| 87 | re turn callb ack(error) ; | |
| 88 | } | |
| 89 | var it ems = ((ob j.items || {}).data || {}).ite ms || obj. items || [ ]; | |
| 90 | async. eachSeries (items, fu nction(ite m, done) { | |
| 91 | // Setup requ est object for patie nt centric search | |
| 92 | ob j.pid = it em.icn || item.pid; | |
| 93 | // Run pep su bsystem ch eck on eac h patient | |
| 94 | ge tPatient(o bj, functi on(err, pa tients) { | |
| 95 | if (err) { | |
| 96 | retu rn callbac k(err); | |
| 97 | } | |
| 98 | var user Permission = userPol icyBuilder (obj, pati ents); | |
| 99 | userPerm ission.res ourceConfi gItemRel = _.result( obj, '_res ourceConfi gItem.rel' , ''); | |
| 100 | userPerm ission.pat ientPid = obj.pid || _.result( obj, 'inte rceptorRes ults.patie ntIdentifi ers.origin alID', '') ; | |
| 101 | userPerm ission.isP atientCent ric = _.re sult(obj, '_resource ConfigItem .isPatient Centric', false); | |
| 102 | rulesEng ine.execut eRules(rul es, userPe rmission, function(r esults) { | |
| 103 | if ( results.co de === 'Pe rmit') { | |
| 104 | item = sen sitivityUt ils.remove SensitiveF ields(item , results) ; | |
| 105 | return don e(); | |
| 106 | } el se if (res ults.code === 'Break Glass') { | |
| 107 | item = sen sitivityUt ils.hideSe nsitiveFie lds(item, results); | |
| 108 | item.sensi tive = tru e; | |
| 109 | return don e(); | |
| 110 | } el se { | |
| 111 | return don e({ | |
| 112 | messag e: results .text, | |
| 113 | code: rdk.httpst atus.forbi dden | |
| 114 | }, null); | |
| 115 | } | |
| 116 | }); | |
| 117 | }) ; | |
| 118 | }, fun ction done (error) { | |
| 119 | ca llback(err or, obj.it ems); | |
| 120 | }); | |
| 121 | }; | |
| 122 | //used for testing o nly | |
| 123 | module.exp orts._getP atient = g etPatient; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.