Produced by Araxis Merge on 11/2/2017 7:18:12 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 | CAPRI_CIF.zip\CAPRI_CIF\Source | untBrkrMthds.pas | Wed Nov 1 18:09:22 2017 UTC |
2 | CAPRI_CIF.zip\CAPRI_CIF\Source | untBrkrMthds.pas | Thu Nov 2 11:52:34 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 530 |
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 | unit untBr krMthds; | |
2 | ||
3 | // DONE: L MS will we need this unit with in CAPRI? Yes, at mi nimum Remo teClaimsLo gin is bei ng used. | |
4 | ||
5 | interface | |
6 | ||
7 | uses Windo ws, Forms, Controls, SysUtils, StrUtils, IniFiles, RpcConf1, | |
8 | { Vis tA Compone nts } | |
9 | MFunS tr | |
10 | , CCO WRPCBroker CAPRI / / DONE: Co deCR457 - LMS Change d from CCO WRPCBroker | |
11 | , Trp cb, dialog sCAPRI, Fm cmpnts; | |
12 | ||
13 | // DONE: L MS Later: All these methods ar e candidat es for rep lacement | |
14 | function E nsureBroke rConnected (Brkr: TCC OWRPCBroke rCAPRI): B oolean; | |
15 | function I sProductio nAccount(B rkr: TCCOW RPCBrokerC APRI): Boo lean; | |
16 | function R econnectBr okerIfDisc onnected(B rkr: TCCOW RPCBrokerC APRI): Boo lean; | |
17 | ||
18 | function G etRemoteAu thenticati onToken(Hm eBrkr: TCC OWRPCBroke rCAPRI): S tring; / / DONE: LM S CodeCR54 0 Expose s ecurity to ken for "g et" for VL ER / DAS a uthenticat or | |
19 | function R emoteClaim sLogin(Hme Brkr: TCCO WRPCBroker CAPRI; Rmt Brkr: TCCO WRPCBroker CAPRI): Bo olean; | |
20 | ||
21 | procedure SetupRemot eBrkr(HmeB rkr: TCCOW RPCBrokerC APRI; RmtB rkr: TCCOW RPCBrokerC APRI); | |
22 | ||
23 | // DONE: C odeCR457 - LMS - rem oved from interface. Used loca lly | |
24 | // SetupR emoteBrkr( HmeBrkr: T CCOWRPCBro ker; RmtBr kr: TCCOWR PCBroker); | |
25 | ||
26 | // DONE: C odeCR457 - LMS Not u sed - remo ved | |
27 | // functi on Authent icateConn( Brkr: TCCO WRPCBroker ): Boolean ; | |
28 | ||
29 | Const | |
30 | XWB_BADS IGNON = 20 000 + 4; // TODO: LMS this is a dupli cate of sa me const i n main.pas . Consolid ate. | |
31 | CLMNSKEY : String = 'Action i s the real measure o f intellig ence. -- N apolean Hi ll'; | |
32 | // Note: VLERAUTHK EY is not compiled i n CAPRI, s o can't be reverse e ngineered out of thi s EXE. VLE RAUTHKEY: String = ' The univer se is equa lly as exp ansive wit hin as wit hout'; | |
33 | ||
34 | implementa tion | |
35 | ||
36 | uses RpcSL ogin | |
37 | , untCo nstVals | |
38 | // , unt MiscMthds | |
39 | , CAPRI Support | |
40 | ; | |
41 | ||
42 | function A uthenticat eConn(Brkr : TCCOWRPC BrokerCAPR I): Boolea n; | |
43 | (*var | |
44 | i: Integ er; | |
45 | Server, Port, x: S tring;*) | |
46 | begin | |
47 | Result : = true; | |
48 | (* DONE: CodeCR457 - lms not needed, w rapped int o CAPRI | |
49 | Result : = False; | |
50 | Server : = ''; | |
51 | Port := ''; | |
52 | for i := 0 to Para mCount do | |
53 | begin | |
54 | x := U pperCase(P iece(Param Str(i), '= ')); | |
55 | if (x = 'S') or (x = 'SERV ER') then | |
56 | Serv er := Piec e(ParamStr (i), '=', 2); | |
57 | if (x = 'P') or (x = 'PORT ') then | |
58 | Port := Piece( ParamStr(i ), '=', 2) ; | |
59 | if ((x = 'CCOW') and SameT ext(UpperC ase(Piece( ParamStr(i ), '=', 2) ), 'OFF')) then | |
60 | Brkr .Contextor := nil; { User For ce Disable Context M anagement } | |
61 | end; { End For Lo op } | |
62 | if ((Sam eText(Serv er, '')) o r (SameTex t(Port, '' ))) then | |
63 | begin | |
64 | { Quit and termi nate app i f Server a nd/or Port are NOT D efined } | |
65 | if (Ge tServerInf o(Server, Port) = mr Cancel) th en | |
66 | Exit ; | |
67 | end; { End If Ser ver or Por t are nil } | |
68 | { Setup CCOWBroker with conf iguration info } | |
69 | Brkr.Ser ver := Sho rtString(C opy(Server ,1,Length( Server))); | |
70 | Brkr.Lis tenerPort := StrToIn t(Port); | |
71 | try | |
72 | Brkr.C onnected : = True; { Try and C onnect to System } | |
73 | Brkr.S howErrorMs gs := TRPC B.semQuiet ; | |
74 | { Ensu re User is authorize d to acces s applicat ion contex t } | |
75 | if Brk r.CreateCo ntext('DVB A CONTRACT ED 2507 EX AM GUI') t hen | |
76 | begin | |
77 | Brkr .RPCTimeLi mit := 288 00; | |
78 | Resu lt := True ; | |
79 | Brkr .ShowError Msgs := TR PCB.semRai se; | |
80 | end { End If Co ntext was succesfull y created } | |
81 | else | |
82 | Appl ication.Me ssageBox(P Char(Brkr. User.Stand ardName + | |
83 | ' is not authorized to access this appl ication.' + #13#10 + | |
84 | 'User mus t be assig ned second ary option : DVBA CON TRACTED 25 07 EXAM GU I.'), | |
85 | 'Authoriz ation Erro r', MB_OK) ; | |
86 | except | |
87 | on E : EBrokerEr ror do | |
88 | begin | |
89 | if ( E.Code <> XWB_BADSIG NON) then | |
90 | Ap plication. MessageBox (PChar(E.M essage), ' Broker Err or', MB_OK ); | |
91 | Brkr .Connected := False; | |
92 | end; { End EBro kerError } | |
93 | end; { End Try/Ex cept } | |
94 | *) | |
95 | end; | |
96 | ||
97 | function E nsureBroke rConnected (Brkr: TCC OWRPCBroke rCAPRI): B oolean; | |
98 | begin | |
99 | Result : = false; | |
100 | try | |
101 | if not CallRPC(B rkr, 'XWB GET VARIAB LE VALUE', ['DUZ'], nil, True) then | |
102 | exit ; | |
103 | //temp DUZ := Brk r.Results[ 0]; | |
104 | except o n e: excep tion do | |
105 | Brkr.C onnected : = true; // if it fail s, then er ror will b e raised t o let user know. | |
106 | end; | |
107 | Result : = Brkr.Con nected; | |
108 | if resul t then | |
109 | applic ation.Proc essMessage s; // all ow timers to do thei r thing | |
110 | end; | |
111 | ||
112 | function R econnectBr okerIfDisc onnected(B rkr: TCCOW RPCBrokerC APRI): Boo lean; | |
113 | var | |
114 | SavBrkrS howErrorMs gs : TShow ErrorMsgs; // DONE: LMS Value s not bein g saved an d set back to origin al properl y. | |
115 | SavBrkrK L, SavBrkr PD : Boole an; | |
116 | SavBrkrL M : TLogin Mode; | |
117 | begin | |
118 | //Result := true; | |
119 | // TODO: LMS if it doesn't w ork, I may not do it . Result : = SilentLo gin(Brkr); | |
120 | (* DONE: lms rewri tten , wra pped into CAPRI *) | |
121 | ||
122 | Result : = Brkr.Con nected; | |
123 | { Reconn ect Silent ly if Brok er Connect ion is los t. | |
124 | Access /Verify co des should still be assigned t o Broker o bject } | |
125 | if Not R esult then | |
126 | begin | |
127 | try | |
128 | SavB rkrKL := B rkr.Kernel LogIn; | |
129 | SavB rkrLM := B rkr.LogIn. Mode; | |
130 | SavB rkrPD := B rkr.LogIn. PromptDivi sion; | |
131 | SavB rkrShowErr orMsgs := Brkr.ShowE rrorMsgs; | |
132 | try | |
133 | Br kr.KernelL ogIn := Fa lse; | |
134 | Br kr.LogIn.M ode := lmA VCodes; | |
135 | Br kr.LogIn.P romptDivis ion := Fal se; | |
136 | Br kr.ShowErr orMsgs := semQuiet; | |
137 | ||
138 | Br kr.Connect ed := True ; | |
139 | Re sult := Si lentLogin( Brkr); // TODO: LMS Brkr.Conne cted; Not sure if t his is tot ally silen t. Also ne ed to add error hand ling. | |
140 | fina lly | |
141 | Br kr.KernelL ogIn := Sa vBrkrKL; | |
142 | Br kr.LogIn.M ode := Sav BrkrLM; | |
143 | Br kr.LogIn.P romptDivis ion := Sav BrkrPD; | |
144 | Br kr.ShowErr orMsgs := SavBrkrSho wErrorMsgs ; | |
145 | end; | |
146 | except | |
147 | Resu lt := fals e; | |
148 | end; | |
149 | end; { End If Not Currently Connected } | |
150 | end; | |
151 | ||
152 | function I sProductio nAccount(B rkr: TCCOW RPCBrokerC APRI): Boo lean; | |
153 | begin | |
154 | //Result := true; | |
155 | (* DONE: lms NOT r emoving *) | |
156 | // Resul t := Brkr. Login.IsPr oductionAc count; // TODO: LMS later, th is may be sufficient and a ser ver call m ay not be necessary. | |
157 | Result : = False; | |
158 | Brkr.Rem oteProcedu re := 'DVB AB CCOW'; | |
159 | Brkr.Par am[0].Valu e := '2'; | |
160 | Brkr.Par am[0].PTyp e := liter al; | |
161 | try | |
162 | Brkr.C all; | |
163 | Result := (StrTo IntDef(Brk r.Results[ 0], 0) > 0 ); | |
164 | except | |
165 | on E: Exception do | |
166 | begin | |
167 | Appl ication.Me ssageBox(P Char('Unab le to dete rmine if P roduction Account.' + | |
168 | #13#10#13 #10 + E.Me ssage), 'B roker Erro r', MB_OK) ; | |
169 | end; { End Exce ption Hand ling - Ide ntify acco unt type a s Test } | |
170 | end; { End Try/Ex cept Block } | |
171 | (**) | |
172 | end; | |
173 | ||
174 | // DONE: lms remov ed from in terface se ction. | |
175 | procedure SetupRemot eBrkr(HmeB rkr: TCCOW RPCBrokerC APRI; RmtB rkr: TCCOW RPCBrokerC APRI); | |
176 | var | |
177 | ini: TIn iFile; | |
178 | ClaimsSe rver, Test ClaimsServ er, X: Str ing; | |
179 | ClaimsPo rt, TestCl aimsPort: Integer; | |
180 | begin | |
181 | ||
182 | // Claim sServer in fo stored in .ini fi le -jltp 07-Mar-201 3 // LMS : Could us e INI file to overri de the har d coded de fault valu es. | |
183 | ini := T IniFile.Cr eate(Piece (Applicati on.ExeName , '.') + ' .ini'); | |
184 | ClaimsServ er := ini. ReadString ('Servers' , 'ClaimsS erver', 'c laims.foru m. DNS '); | |
185 | TestClaims Server := ini.ReadSt ring('Serv ers', 'Tes tClaimsSer ver', 'vis ta. DNS . URL '); | |
186 | X := ini .ReadStrin g('Servers ', 'Claims Port', '94 00'); | |
187 | ClaimsPo rt := StrT oInt(X); | |
188 | X := ini .ReadStrin g('Servers ', 'TestCl aimsPort', '9401'); | |
189 | TestClai msPort := StrToInt(X ); | |
190 | ||
191 | if IsPro ductionAcc ount(HmeBr kr) then | |
192 | with RmtBrkr do | |
193 | begin | |
194 | Serv er := Clai msServer; | |
195 | List enerPort : = ClaimsPo rt; | |
196 | end { End With for Broker - Product ion Accoun t (CLAIMS) } | |
197 | else { Test Accou nt Connect ion to TES TCLAIMS Sy stem } | |
198 | with RmtBrkr do | |
199 | begin | |
200 | Serv er := Test ClaimsServ er; | |
201 | List enerPort : = TestClai msPort; | |
202 | end; { End With for Broke r - Test A ccount (TE STCLAIMS) } | |
203 | ini.Free ; | |
204 | end; | |
205 | (**) | |
206 | ||
207 | /// Return s authenti cation tok en from ho me broker that can b e combined with Appl ication Ke y to creat e a securi ty phrase for RPC Br oker BSE l ogin to re mote broke r. | |
208 | /// e.g. R mtBrkr.Sec urityPhras e := CLMNS KEY + '^' + GetRemot eAuthentic ationToken (HmeBrkr); | |
209 | function G etRemoteAu thenticati onToken(Hm eBrkr: TCC OWRPCBroke rCAPRI): S tring; // LMS: 20 13-12-10 R efactored to use wit h CCR as w ell as VLE R Authenti cation | |
210 | var | |
211 | HmeBSETo ken, HmeLi stenerPort : string; | |
212 | begin | |
213 | Result : = ''; | |
214 | { BSE Do c on VDL i ndicates P ublic RPC, but FORUM shows as Private #5 501 | |
215 | CAPRI does NOT h ave an IA. } | |
216 | HmeBrkr. RemoteProc edure := ' XUS SET VI SITOR'; // DONE: LMS check into need for set co ntext to D VBA CAPRI GUI as per Joel.. ma y be outda ted or not relevant? Yes, Cont ext is nee ded to dou ble ensure only CAPR I authenti cated user s connect. | |
217 | HmeBrkr. Call; | |
218 | if (HmeB rkr.Connec ted and (H meBrkr.Res ults.Count > 0)) the n | |
219 | begin | |
220 | { Setu p automati c remote g uest login to approp riate CLAI MS system. | |
221 | Secu rity = KEY in REMOTE APPLICATI ON File (8 994.5) Con nected to B-Type | |
222 | Con text Optio n ^ BSE To ken create d from XUS SET VISTO R | |
223 | RPC Call ^ Vi stA Instan ce Number (Station N umber) ^ | |
224 | Bro ker Home P ort # for Remote Ser ver to cal l back on } | |
225 | HmeBSE Token := H meBrkr.Res ults[0]; | |
226 | HmeLis tenerPort := IntToSt r(HmeBrkr. ListenerPo rt); | |
227 | Result := HmeBSE Token + '^ ' + TCCOWR PCBrokerCA PRI(HmeBrk r).Station + '^' + H meListener Port; // DONE: LMS This is th e only pla ce we use station in stead of d ivision. $$SITE^VA SITE alway s returns that same Station# ( and it is associated with the VistA inst ance that user has f irst authe nticated t o) | |
228 | end; | |
229 | end; | |
230 | ||
231 | function R emoteClaim sLogin(Hme Brkr: TCCO WRPCBroker CAPRI; Rmt Brkr: TCCO WRPCBroker CAPRI): Bo olean; | |
232 | begin | |
233 | Result : = False; | |
234 | { Determ ine Server Location/ Connection Info - TE STCLAIMS o r CLAIMS ( Production ) | |
235 | Note: For Use in TEST ACCO UNTS the u ser must b e assigned the Secur ity Key | |
236 | ZJFW CONTR ACTED EXM TEST. Also DEVFEX is configure d in TESTC LAIMS | |
237 | HL LOGICAL Link File to callba ck. Any ad ditional T est Accoun ts will | |
238 | need to be configure d if conne ction is r equired. } | |
239 | SetupRem oteBrkr(Hm eBrkr, Rmt Brkr); | |
240 | { Create BSE Token } | |
241 | try | |
242 | RmtBrk r.Security Phrase := GetRemoteA uthenticat ionToken(H meBrkr); | |
243 | if Rmt Brkr.Secur ityPhrase <> '' then | |
244 | begin | |
245 | RmtB rkr.Securi tyPhrase : = CLMNSKEY + '^' + R mtBrkr.Sec urityPhras e; | |
246 | RmtB rkr.Connec ted := Tru e; { Try and Connec t to Remot e System } | |
247 | if R mtBrkr.Con nected the n | |
248 | begi n | |
249 | Rm tBrkr.Crea teContext( CAPRICCRRE MOTEACCESS OPTION); / / 'DVBA CO NTRACTED 2 507 EXAM G UI'); | |
250 | Rm tBrkr.RPCT imeLimit : = 28800; | |
251 | {$ IFDEF CAPR IDEVELOPER } | |
252 | Rm tBrkr.RPCT imeLimit : = 2880000; // LMS - for debu gging | |
253 | {$ ENDIF} | |
254 | Re sult := Tr ue; | |
255 | end; { End If Connectio n to remot e system s uccessful } | |
256 | end; { Host/Hom e Broker i s connecte d and RPC returned r esults } | |
257 | except | |
258 | on E: EBrokerErr or do | |
259 | begin | |
260 | Show MessageCAP RI('Remote broker er ror: ' + # 13#10 + PC har((E.Mes sage))); | |
261 | {TOD O: CKU -> bug E.Mess age is vie wed as uni code chars on Win 7. } | |
262 | end; { End Exce ption Hand ling Block } | |
263 | end; { End Try/Ex cept Block } | |
264 | (**) | |
265 | end; | |
266 | ||
267 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.