Produced by Araxis Merge on 12/21/2017 6:15:12 PM Eastern Standard 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 | Genisis_2.0_v7_bld7.zip\TS\Client\src\app\services | system-services.ts | Thu Dec 14 19:56:21 2017 UTC |
| 2 | Genisis_2.0_v7_bld7.zip\TS\Client\src\app\services | system-services.ts | Thu Dec 21 14:22:29 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 278 |
| 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 | import { I njectable } from '@a ngular/cor e'; | |
| 2 | import { H ttp, Respo nse, Heade rs, Reques tOptions } from '@an gular/http '; | |
| 3 | import { C ookieServi ce } from 'ngx-cooki e-service' ; | |
| 4 | import { N gRedux } f rom 'ng2-r edux'; | |
| 5 | import { I AppState } from '../ store'; | |
| 6 | ||
| 7 | import { e nvironment } from '. ./../envir onments/en vironment' ; | |
| 8 | import { | |
| 9 | SET_SESS ION, | |
| 10 | FETCH_BO OKMARKS, | |
| 11 | FOCUS_ON | |
| 12 | } from '.. /actions'; | |
| 13 | ||
| 14 | import { | |
| 15 | RESEARCHER _ROLE, | |
| 16 | TERMINOLOG IST_ROLE, | |
| 17 | } from '.. /constants '; | |
| 18 | ||
| 19 | import { B ookmarkSer vices } fr om '../ser vices/book mark-servi ces'; | |
| 20 | ||
| 21 | @Injectabl e() | |
| 22 | export cla ss SystemS ervices { | |
| 23 | construc tor( | |
| 24 | privat e ngRedux: NgRedux<I AppState>, | |
| 25 | privat e http: Ht tp, | |
| 26 | privat e cookieSe rvices: Co okieServic e, | |
| 27 | privat e bookmark Services: BookmarkSe rvices) {} | |
| 28 | ||
| 29 | // thi s.cookieSe rvice.set( 'Test', ' Hello Worl d' ); | |
| 30 | // thi s.cookieVa lue = this .cookieSer vice.get(' Test'); | |
| 31 | ||
| 32 | getSta te() { | |
| 33 | retu rn this.ng Redux.getS tate(); | |
| 34 | } | |
| 35 | ||
| 36 | focusO n(element, timeOverr ide = null ) { | |
| 37 | this .ngRedux.d ispatch({ | |
| 38 | ty pe: FOCUS_ ON, | |
| 39 | pa yload: '' | |
| 40 | }); | |
| 41 | setT imeout(()= > { | |
| 42 | th is.ngRedux .dispatch( { | |
| 43 | type: FOCU S_ON, | |
| 44 | payload: e lement | |
| 45 | }) ; | |
| 46 | }, ( timeOverri de || 500) ); | |
| 47 | } | |
| 48 | ||
| 49 | postMe ssageUpdat e() { | |
| 50 | wind ow.top.pos tMessage({ cmd: 'upda te_all'}, '*'); | |
| 51 | } | |
| 52 | ||
| 53 | async validateSS O() { | |
| 54 | if ( environmen t.producti on && this .getState( ).system.e nvironment .productio n) { | |
| 55 | aw ait this.h ttp.get('/ ').subscri be((respon se: Respon se) => { | |
| 56 | const clie ntSDn = re sponse.hea ders.get(' SSL_CLIENT _S_DN'); | |
| 57 | if (client SDn === un defined || clientSDn === null) { | |
| 58 | return f alse; | |
| 59 | } else { | |
| 60 | const pa rsedClient SDn = this .parseClie ntSDn(clie ntSDn); | |
| 61 | if (this .validateC lientSDn(p arsedClien tSDn)) { | |
| 62 | // Set Cookie | |
| 63 | this.c ookieServi ces.set( ' username', parsedCli entSDn['UI D'] ); | |
| 64 | this.s etSession( parsedClie ntSDn['UID ']); | |
| 65 | this.b ookmarkSer vices.fetc hAllBookma rks().subs cribe( | |
| 66 | (res ponse: Res ponse) => { | |
| 67 | th is.ngRedux .dispatch( { | |
| 68 | type: FETC H_BOOKMARK S, | |
| 69 | payload: J SON.parse( response.t ext()).res ponse | |
| 70 | }) ; | |
| 71 | }); | |
| 72 | return true; | |
| 73 | } else { | |
| 74 | return false; | |
| 75 | } | |
| 76 | } | |
| 77 | }) ; | |
| 78 | } el se { | |
| 79 | this.cooki eServices. set('usern ame', PII '); | |
| 80 | PII '); | |
| 81 | th is.bookmar kServices. fetchAllBo okmarks(). subscribe( | |
| 82 | (response: Response) => { | |
| 83 | this.ngR edux.dispa tch({ | |
| 84 | type: FETCH_BOOK MARKS, | |
| 85 | payloa d: JSON.pa rse(respon se.text()) .response | |
| 86 | }); | |
| 87 | }); | |
| 88 | re turn true; | |
| 89 | } | |
| 90 | } | |
| 91 | ||
| 92 | parseC lientSDn(s sl_client_ s_din) { | |
| 93 | let clientSDn = {}; | |
| 94 | // s eparate by spaces fi rst | |
| 95 | if ( ssl_client _s_din) { | |
| 96 | le t headerAr ray = ssl_ client_s_d in.split(' ,'); | |
| 97 | fo r (let i = 0; i < he aderArray. length; i+ +) { | |
| 98 | let arr = headerArra y[i].split ('='); | |
| 99 | clientSDn[ arr[0]] = arr[1]; | |
| 100 | } | |
| 101 | re turn clien tSDn; | |
| 102 | } el se { | |
| 103 | re turn null; | |
| 104 | } | |
| 105 | } | |
| 106 | ||
| 107 | valida teClientSD n(clientSD n) { | |
| 108 | if ( clientSDn[ 'UID'] && clientSDn[ 'UID'].len gth > 0 && clientSDn [ | |
| 109 | 'UID'].ind exOf('@') >= | |
| 110 | 0) { | |
| 111 | re turn true; | |
| 112 | } | |
| 113 | ||
| 114 | retu rn false; | |
| 115 | } | |
| 116 | ||
| 117 | async isAuthenti cated() { | |
| 118 | //co nst userna me = this. cookieServ ices.get(' username') ; | |
| 119 | cons t username = this.ge tState().s ystem.sess ion.userna me; | |
| 120 | if ( (username !== undefi ned || use rname !== null) && u sername.le ngth > 0) { | |
| 121 | re turn true; | |
| 122 | } el se { | |
| 123 | re turn false ; | |
| 124 | } | |
| 125 | } | |
| 126 | ||
| 127 | setSes sion(logge dInUsernam e) { | |
| 128 | if ( (loggedInU sername != = undefine d || logge dInUsernam e !== null ) && logge dInUsernam e.length > 0) { | |
| 129 | th is.ngRedux .dispatch( { | |
| 130 | type: SET_ SESSION, | |
| 131 | payload: { username: loggedInUs ername, us erRole: RE SEARCHER_R OLE} | |
| 132 | }) ; | |
| 133 | } | |
| 134 | } | |
| 135 | ||
| 136 | async fetchBookm arks(): Pr omise<any> { | |
| 137 | let response = await thi s.bookmark Services | |
| 138 | .fet chAllBookm arks().toP romise(); | |
| 139 | retu rn respons e.text(); | |
| 140 | } | |
| 141 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.