source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/m/BMXRPC7.m@ 813

Last change on this file since 813 was 645, checked in by Sam Habiel, 15 years ago

Initial Import of BMX.net code

File size: 5.7 KB
Line 
1BMXRPC7 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;
2 ;;2.1;BMX;;Jul 26, 2009
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=""
12 N X,BMXUSER,BMXUNOW,BMXUM,BMXUMSG,BMXVCOK K DUZ
13 S BMXRET(0)=0,BMXRET(5)=0,BMXUM=0,BMXUMSG=0
14 S DUZ=0,DUZ(0)="",BMXVCOK=0 D NOW ;IHS/OIT/HMW SAC Exemption Applied For
15 S BMXUMSG=$$INHIBIT() I BMXUMSG S BMXUM=1 G VAX ;Logon inhibited
16 ;
17 S DUZ=$$WINUGET^BMXRPC3(BMXWINID) ;IHS/OIT/HMW SAC Exemption Applied For
18 I DUZ>0 D USER(DUZ)
19 S BMXUMSG=$$UVALID() G:BMXUMSG VAX
20 I DUZ>0 S BMXUMSG=$$POST(1)
21VAX S:BMXUMSG>0 DUZ=0 D:DUZ>0 POST2
22 S BMXRET(0)=DUZ,BMXRET(1)=BMXUM,BMXRET(2)=BMXVCOK,BMXRET(3)=$S(BMXUMSG:$$TXT(BMXUMSG),1:""),BMXRET(4)=0
23 Q
24 ;
25NOW S U="^",BMXUNOW=$$NOW^XLFDT(),DT=$P(BMXUNOW,".")
26 Q
27 ;
28USER(IX) ;Build USER
29 S BMXUSER(0)=$G(^VA(200,+IX,0)),BMXUSER(1)=$G(^(.1))
30 Q
31 ;
32POST(CVC) ;Finish setup partition, I CVC don't log get
33 N X,BMXUM
34 K ^UTILITY($J),^TMP($J)
35 I '$D(USER(0)),DUZ D USER(DUZ)
36 S BMXUM=$$USER1A Q:BMXUM>0 BMXUM ;User can't sign on for some reason.
37 S BMXRET(5)=0 ;The next line sends the post sign-on msg
38 F BMXPT=1:1 Q:'$D(BMXUTEXT(BMXPT)) S BMXRET(5+BMXPT)=$E(BMXUTEXT(BMXPT),2,256),BMXRET(5)=BMXPT
39 S BMXRET(5)=0 ;This line stops the display of the msg. Remove this line to allow.
40 D:'$G(CVC) POST2
41 Q 0
42POST2 D:'$D(BMXUNOW) NOW
43 D DUZ ;^XUS1A ;,SAVE^XUS1,LOG^XUS1,ABT^XQ12
44 K BMXUTEXT,BMXOPT,BMXUER ;XUEON,XUEOFF,XUTT
45 Q
46 ;
47DUZ ;Setup DUZ. SAC exemption applied for.
48 S:'$D(BMXUSER(0)) BMXUSER(0)=^VA(200,DUZ,0) D:$D(BMXOPT)[0 BMXOPT
49 S DUZ(0)=$P(BMXUSER(0),U,4),DUZ(1)="",DUZ("AUTO")=$P(BMXOPT,"^",6) ;IHS/OIT/HMW SAC Exemption Applied For
50 S DUZ(2)=$S($G(DUZ(2))>0:DUZ(2),1:+$P(BMXOPT,U,17)) ;IHS/OIT/HMW SAC Exemption Applied For
51 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))
52 S DUZ("BUF")=($P(BMXOPT,U,9)="Y"),DUZ("LANG")=$P(BMXOPT,U,7) ;IHS/OIT/HMW SAC Exemption Applied For
53 Q
54 ;
55USER1A() ;
56 N BMXPTB,BMXPTE,BMXPTT
57 S BMXUTEXT=0,DUZ(2)=0
58 F I=0:0 S I=$O(^XTV(8989.3,1,"POST",I)) Q:I'>0 D SET("!"_$G(^(I,0)))
59 D SET("!"),BMXOPT
60 S BMXPTH=$P($H,",",2)
61 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)))
62 S BMXI1=$G(^VA(200,DUZ,1.1)),X=(+BMXI1_"0000")
63 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))
64 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.")
65 I $P(BMXUSER(0),U,12),$$PROHIBIT(BMXPTH,$P(BMXUSER(0),U,12)) Q 17 ;Time frame
66 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")
67 S:$P(BMXOPT,"^",5) XUTT=1 S:'$D(DTIME) DTIME=$P(BMXOPT,U,10)
68 I ('X)!$P(BMXOPT,U,4) Q 0
69 Q 9
70 ;
71BMXOPT ;Build the BMXOPT string
72 N X,I
73 S:'$D(BMXOPT) BMXOPT=$G(^XTV(8989.3,1,"XUS"))
74 S X=$G(^VA(200,DUZ,200))
75 F I=4:1:7,9,10 I $P(X,U,I)]"" S $P(BMXOPT,"^",I)=$P(X,U,I)
76 Q
77 ;
78SET(V) ;Set into BMXUTEXT(BMXUTEXT)
79 S BMXUTEXT=$G(BMXUTEXT)+1,BMXUTEXT(BMXUTEXT)=V
80 Q
81 ;
82PROHIBIT(BMXPTT,BMXPTR) ;See if a prohibited time, (Current time, restrict range)
83 N XMSG,BMXPTB,BMXPTE
84 S BMXPTT=BMXPTT\60#60+(BMXPTT\3600*100),BMXPTB=$P(BMXPTR,"-",1),BMXPTE=$P(BMXPTR,"-",2)
85 S XMSG=$P($$FMTE^XLFDT(DT_"."_BMXPTB,"2P")," ",2,3)_" thru "_$P($$FMTE^XLFDT(DT_"."_BMXPTE,"2P")," ",2,3)
86 I $S(BMXPTE'<BMXPTB:BMXPTT'>BMXPTE&(BMXPTT'<BMXPTB),1:BMXPTT>BMXPTB!(BMXPTT<BMXPTE)) S BMXUM(0)=XMSG Q 1 ;No
87 D SET("!")
88 D SET("! Your access is restricted during this time frame "_XMSG)
89 Q 0
90 ;
91INHIBIT() ;Is Logon to this system Inhibited?
92 N BMXENV,BMXCI,BMXQVOL,BMXVOL
93 D GETENV^%ZOSV S U="^",BMXENV=Y,BMXCI=$P(Y,U,1),BMXQVOL=$P(Y,U,2)
94 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
95 ;I '$D(BMXQVOL) Q 0
96 ;I '$D(BMXVOL) Q 0
97 I $G(^%ZIS(14.5,"LOGON",BMXQVOL)) Q 1
98 I $D(^%ZOSF("ACTJ")) X ^("ACTJ") I $P(BMXVOL,U,3),($P(BMXVOL,U,3)'>Y) Q 2
99 Q 0
100 ;
101 ;
102UVALID() ;EF. Is it valid for this user to sign on?
103 I '+$G(BMXWIN) Q 18
104 I DUZ'>0 Q 4
105 I $P(BMXUSER(0),U,11),$P(BMXUSER(0),U,11)'>DT Q 11 ;Access Terminated
106 I $P(BMXUSER(0),U,7) Q 5 ;Disuser flag set
107 Q 0
108 ;
109DD(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)
110 Q
111 ;
112TXT(BMXPT) ;
113 S BMXPT=$T(ZZ+BMXPT)
114 S BMXPT=$P(BMXPT,";",4,9) I BMXPT["|" S BMXPT=$P(BMXPT,"|",1)_$G(BMXUM(0))_$P(BMXPT,"|",2)
115 Q BMXPT
116ZZ ;;Halt;Error Messages
1171 ;;1;Signons not currently allowed on this processor.
1182 ;;1;Maximum number of users already signed on to this processor.
1193 ;;1;This device has not been defined to the system -- contact system manager.
1204 ;;0;Not a valid Windows Identity map value.
1215 ;;0;No Access Allowed for this User.
1226 ;;0;Invalid device password.
1237 ;;0;Device locked due to too many invalid sign-on attempts.
1248 ;;1;This device is out of service.
1259 ;;0;*** MULTIPLE SIGN-ONS NOT ALLOWED ***
12610 ;;1;You don't have access to this device!
12711 ;;0;Your access code has been terminated. Please see your site manager!
12812 ;;0;VERIFY CODE MUST be changed before continued use.
12913 ;;1;This device may only be used outside of this time frame |
13014 ;;0;'|' is not a valid UCI!
13115 ;;0;'|' is not a valid program name!
13216 ;;0;No PRIMARY MENU assigned to user or User is missing KEY to menu!
13317 ;;0;Your access to the system is prohibited from |.
13418 ;;0;Windows Integrated Security Not Allowed on this port.
Note: See TracBrowser for help on using the repository browser.