source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/routines/BMXRPC7.m@ 1720

Last change on this file since 1720 was 1147, checked in by Sam Habiel, 14 years ago

Mumps Routines 4 BMX4

File size: 5.8 KB
Line 
1BMXRPC7 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;
2 ;;4.1000;BMX;;Apr 17, 2011
3 ;
4 ;
5WINVAL(BMXRET,BMXWINID) ;EP
6 ;Validates user based on Windows Identity
7 ;
8 ;Return R(0)=DUZ, R(1)=(0=OK, 1,2...=Can't sign-on for some reason)
9 ; R(2)=verify needs changing, R(3)=Message, R(4)=0, R(5)=msg cnt, R(5+n)
10 ; R(R(5)+6)=# div user must select from, R(R(5)+6+n)=div
11 I $$NEWERR^%ZTER N $ETRAP S $ETRAP="" ; IHS/OIT/HMW SAC Exemption Applied For
12 N X,BMXUSER,BMXUNOW,BMXUM,BMXUMSG,BMXVCOK
13 S %="DUZ" K @%
14 S BMXRET(0)=0,BMXRET(5)=0,BMXUM=0,BMXUMSG=0
15 S DUZ=0,DUZ(0)="",BMXVCOK=0 D NOW ;IHS/OIT/HMW SAC Exemption Applied For
16 S BMXUMSG=$$INHIBIT() I BMXUMSG S BMXUM=1 G VAX ;Logon inhibited
17 ;
18 S DUZ=$$WINUGET^BMXRPC3(BMXWINID) ;IHS/OIT/HMW SAC Exemption Applied For
19 I DUZ>0 D USER(DUZ)
20 S BMXUMSG=$$UVALID() G:BMXUMSG VAX
21 I DUZ>0 S BMXUMSG=$$POST(1)
22VAX S:BMXUMSG>0 DUZ=0 D:DUZ>0 POST2
23 S BMXRET(0)=DUZ,BMXRET(1)=BMXUM,BMXRET(2)=BMXVCOK,BMXRET(3)=$S(BMXUMSG:$$TXT(BMXUMSG),1:""),BMXRET(4)=0
24 Q
25 ;
26NOW S U="^",BMXUNOW=$$NOW^XLFDT(),DT=$P(BMXUNOW,".")
27 Q
28 ;
29USER(IX) ;Build USER
30 S BMXUSER(0)=$G(^VA(200,+IX,0)),BMXUSER(1)=$G(^(.1))
31 Q
32 ;
33POST(CVC) ;Finish setup partition, I CVC don't log get
34 N X,BMXUM
35 K ^UTILITY($J),^TMP($J)
36 I '$D(USER(0)),DUZ D USER(DUZ)
37 S BMXUM=$$USER1A Q:BMXUM>0 BMXUM ;User can't sign on for some reason.
38 S BMXRET(5)=0 ;The next line sends the post sign-on msg
39 F BMXPT=1:1 Q:'$D(BMXUTEXT(BMXPT)) S BMXRET(5+BMXPT)=$E(BMXUTEXT(BMXPT),2,256),BMXRET(5)=BMXPT
40 S BMXRET(5)=0 ;This line stops the display of the msg. Remove this line to allow.
41 D:'$G(CVC) POST2
42 Q 0
43POST2 D:'$D(BMXUNOW) NOW
44 D DUZ ;^XUS1A ;,SAVE^XUS1,LOG^XUS1,ABT^XQ12
45 K BMXUTEXT,BMXOPT,BMXUER ;XUEON,XUEOFF,XUTT
46 Q
47 ;
48DUZ ;Setup DUZ. SAC exemption applied for.
49 S:'$D(BMXUSER(0)) BMXUSER(0)=^VA(200,DUZ,0) D:$D(BMXOPT)[0 BMXOPT
50 S DUZ(0)=$P(BMXUSER(0),U,4),DUZ(1)="",DUZ("AUTO")=$P(BMXOPT,"^",6) ;IHS/OIT/HMW SAC Exemption Applied For
51 S DUZ(2)=$S($G(DUZ(2))>0:DUZ(2),1:+$P(BMXOPT,U,17)) ;IHS/OIT/HMW SAC Exemption Applied For
52 S X=$P($G(^DIC(4,DUZ(2),99)),U,5),DUZ("AG")=$S(X]"":X,1:$P(^XTV(8989.3,1,0),U,8))
53 S DUZ("BUF")=($P(BMXOPT,U,9)="Y"),DUZ("LANG")=$P(BMXOPT,U,7) ;IHS/OIT/HMW SAC Exemption Applied For
54 Q
55 ;
56USER1A() ;
57 N BMXPTB,BMXPTE,BMXPTT
58 S BMXUTEXT=0,DUZ(2)=0
59 F I=0:0 S I=$O(^XTV(8989.3,1,"POST",I)) Q:I'>0 D SET("!"_$G(^(I,0)))
60 D SET("!"),BMXOPT
61 S BMXPTH=$P($H,",",2)
62 D SET("!Good "_$S(BMXPTH<43200:"morning ",BMXPTH<61200:"afternoon ",1:"evening ")_$S($P(BMXUSER(1),U,4)]"":$P(BMXUSER(1),U,4),1:$P(BMXUSER(0),U,1)))
63 S BMXI1=$G(^VA(200,DUZ,1.1)),X=(+BMXI1_"0000")
64 I X D SET("! You last signed on "_$S(X\1=DT:"today",X\1+1=DT:"yesterday",1:$$DD(X))_" at "_$E(X,9,10)_":"_$E(X,11,12))
65 I $P(BMXI1,"^",2) S I=$P(BMXI1,"^",2) D SET("!There "_$S(I>1:"were ",1:"was ")_I_" unsuccessful attempt"_$S(I>1:"s",1:"")_" since you last signed on.")
66 I $P(BMXUSER(0),U,12),$$PROHIBIT(BMXPTH,$P(BMXUSER(0),U,12)) Q 17 ;Time frame
67 I +$P(BMXOPT,U,15) S BMXPT=$P(BMXOPT,U,15)-($H-BMXUSER(1)) I BMXPT<6,BMXPT>0 D SET("! Your Verify code will expire in "_BMXPT_" days")
68 S:$P(BMXOPT,"^",5) XUTT=1 S:'$D(DTIME) DTIME=$P(BMXOPT,U,10) ; IHS/OIT/HMW SAC Exemption Applied For
69 I ('X)!$P(BMXOPT,U,4) Q 0
70 Q 9
71 ;
72BMXOPT ;Build the BMXOPT string
73 N X,I
74 S:'$D(BMXOPT) BMXOPT=$G(^XTV(8989.3,1,"XUS"))
75 S X=$G(^VA(200,DUZ,200))
76 F I=4:1:7,9,10 I $P(X,U,I)]"" S $P(BMXOPT,"^",I)=$P(X,U,I)
77 Q
78 ;
79SET(V) ;Set into BMXUTEXT(BMXUTEXT)
80 S BMXUTEXT=$G(BMXUTEXT)+1,BMXUTEXT(BMXUTEXT)=V
81 Q
82 ;
83PROHIBIT(BMXPTT,BMXPTR) ;See if a prohibited time, (Current time, restrict range)
84 N XMSG,BMXPTB,BMXPTE
85 S BMXPTT=BMXPTT\60#60+(BMXPTT\3600*100),BMXPTB=$P(BMXPTR,"-",1),BMXPTE=$P(BMXPTR,"-",2)
86 S XMSG=$P($$FMTE^XLFDT(DT_"."_BMXPTB,"2P")," ",2,3)_" thru "_$P($$FMTE^XLFDT(DT_"."_BMXPTE,"2P")," ",2,3)
87 I $S(BMXPTE'<BMXPTB:BMXPTT'>BMXPTE&(BMXPTT'<BMXPTB),1:BMXPTT>BMXPTB!(BMXPTT<BMXPTE)) S BMXUM(0)=XMSG Q 1 ;No
88 D SET("!")
89 D SET("! Your access is restricted during this time frame "_XMSG)
90 Q 0
91 ;
92INHIBIT() ;Is Logon to this system Inhibited?
93 N BMXENV,BMXCI,BMXQVOL,BMXVOL
94 D GETENV^%ZOSV S U="^",BMXENV=Y,BMXCI=$P(Y,U,1),BMXQVOL=$P(Y,U,2)
95 S X=$O(^XTV(8989.3,1,4,"B",BMXQVOL,0)),BMXVOL=$S(X>0:^XTV(8989.3,1,4,X,0),1:BMXQVOL_"^y^1") S:$P(BMXVOL,U,6)="y" XRTL=BMXCI_","_BMXQVOL
96 ;I '$D(BMXQVOL) Q 0
97 ;I '$D(BMXVOL) Q 0
98 I $G(^%ZIS(14.5,"LOGON",BMXQVOL)) Q 1
99 I $D(^%ZOSF("ACTJ")) X ^("ACTJ") I $P(BMXVOL,U,3),($P(BMXVOL,U,3)'>Y) Q 2
100 Q 0
101 ;
102 ;
103UVALID() ;EF. Is it valid for this user to sign on?
104 I '+$G(BMXWIN) Q 18
105 I DUZ'>0 Q 4
106 I $P(BMXUSER(0),U,11),$P(BMXUSER(0),U,11)'>DT Q 11 ;Access Terminated
107 I $P(BMXUSER(0),U,7) Q 5 ;Disuser flag set
108 Q 0
109 ;
110DD(Y) Q $S($E(Y,4,5):$P("Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec","^",+$E(Y,4,5))_" ",1:"")_$S($E(Y,6,7):+$E(Y,6,7)_",",1:"")_($E(Y,1,3)+1700)
111 Q
112 ;
113TXT(BMXPT) ;
114 S BMXPT=$T(ZZ+BMXPT)
115 S BMXPT=$P(BMXPT,";",4,9) I BMXPT["|" S BMXPT=$P(BMXPT,"|",1)_$G(BMXUM(0))_$P(BMXPT,"|",2)
116 Q BMXPT
117ZZ ;;Halt;Error Messages
1181 ;;1;Signons not currently allowed on this processor.
1192 ;;1;Maximum number of users already signed on to this processor.
1203 ;;1;This device has not been defined to the system -- contact system manager.
1214 ;;0;Not a valid Windows Identity map value.
1225 ;;0;No Access Allowed for this User.
1236 ;;0;Invalid device password.
1247 ;;0;Device locked due to too many invalid sign-on attempts.
1258 ;;1;This device is out of service.
1269 ;;0;*** MULTIPLE SIGN-ONS NOT ALLOWED ***
12710 ;;1;You don't have access to this device!
12811 ;;0;Your access code has been terminated. Please see your site manager!
12912 ;;0;VERIFY CODE MUST be changed before continued use.
13013 ;;1;This device may only be used outside of this time frame |
13114 ;;0;'|' is not a valid UCI!
13215 ;;0;'|' is not a valid program name!
13316 ;;0;No PRIMARY MENU assigned to user or User is missing KEY to menu!
13417 ;;0;Your access to the system is prohibited from |.
13518 ;;0;Windows Integrated Security Not Allowed on this port.
Note: See TracBrowser for help on using the repository browser.