XQSMD2 ; SEA/MJM - Secure MenuMan Delegation (Cont.) ;7/3/91 08:42 ;8/21/92 11:58 AM [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
S U="^",XQMG=DUZ,XQNGO=0
BUILD ;Put remaining options into Delgate Options File
S (XQM,XQN)="" D LIST I XQM=-1!(XQN=-1) G OUT
D:$Y+2>IOSL WAIT W !!!,"Ready to ",$S(XQDOP:"remove these options from",1:"delegate these options to")," these people? Y// " R XQ:DTIME S:'$T XQ=U G:XQ=U OUT S:XQ="" XQ="Y" G:"YyNn"'[XQ BUILD
I XQ["N"!(XQ["n") W !!,"Fine, you may edit the user or option list, or enter a '^' to quit." G NAME^XQSMD
I '$D(^TMP($J,"OP")) W !!,"No options found, no action taken.",*7 G OUT
;
ZTLOAD ;Set up Taskman parameters an queue the request
S ZTRTN="ZTSK^XQSMD31",ZTDTH=$H,ZTIO="",(XQDESC,ZTDESC)=XQMGR_" "_$S(XQDOP:"remov",1:"add")_"ing delegated options"
S ZTSAVE("^TMP($J,")="",ZTSAVE("XQDOP")="",ZTSAVE("XQLEV")="",ZTSAVE("XQHOLD(")="",ZTSAVE("XQPRO")=""
D ^%ZTLOAD
W !!,"Request to ",$S(XQDOP:"remove",1:"add")," delegated options has been queued, task # ",ZTSK,",",!?5,"named: ",XQDESC,"."
;
SCAN ;Scan selected options for restrictions and report them
S XQN=""
F XQI=0:0 D:$Y+3>IOSL WAIT Q:XQ=U S XQN=$O(^TMP($J,"ZN",XQN)) Q:XQN="" S XQON0=^(XQN) S:$L($P(XQON0,U,5)) XQLK(XQN)=$P(XQON0,U,5) D:$L($P(XQON0,U,2)) OOO D RTIM D:$L($P(XQON0,U,9)) RDEV
S XQKEY(0)="",XQN="",DIC=19.1,DIC(0)="FMXZ",XQI=0
F XQJ=0:0 S XQN=$O(XQLK(XQN)) Q:XQN="" S X=XQLK(XQN) D ^DIC I Y>0,'$D(XQKEY(+Y)),$S($D(^XUSEC("XUMGR",DUZ)):1,$D(^VA(200,DUZ,52,"B",+Y)):1,1:0) S XQKEY(+Y)="",XQI=XQI+1
;
I $O(XQKEY(0))'="" D KEYS^XQSMD21 ;Allocate keys for locked options
;
G OUT
Q
;
OOO W !,XQN," is out of order with the string: '",$P(XQON0,U,2),"'" Q
;
RTIM ; Identify and display prohibited times for option
S %A="",XQON=$O(^DIC(19,"B",XQN,0)) I $D(^DIC(19,XQON,3.91)) F %XQI=0:0 S %XQI=$O(^DIC(19,XQON,3.91,%XQI)) Q:%XQI'>0 W !,XQN," is PROHIBITED during the times ",$P(^(%XQI,0),U,1),$P(^(0),U,2)," (military time)." K %A
K %XQI I $D(%A) K %A I $L($P(XQON0,U,8)) W !,XQN," is PROHIBITED during the times ",$P(XQON0,U,8)," (military time)."
Q
;
RDEV W !,XQN," is restricted to run on only certain devices." Q
;
LIST ;List users and options selected so far.
W @IOF S (XQT,XQM)=0,XQM=$O(XQHOLD(XQM)) I XQM="" W !!," No users selected yet." S XQM=-1 Q
W !!,"For the following user(s):",!
F XQI=1:1 D:$Y+2>IOSL WAIT Q:XQ=U W:'(XQT#2) ! W ?(XQT#2*35),XQI,". ",XQHOLD(XQM) S XQT=XQT+1,XQM=$O(XQHOLD(XQM)) Q:XQM=""
W !!,"You will ",$S(XQDOP:"remove ",1:"delegate "),"the following options: ",!
S XQT=0,XQN="",XQN=$O(^TMP($J,"ZN",XQN)) I XQN="" W !!,"No menu options selected yet" S XQN=-1 Q
F XQI=0:0 D:$Y+2>IOSL WAIT Q:XQ=U W !,XQN," ",$P(^TMP($J,"ZN",XQN),U,1) S XQN=$O(^(XQN)) Q:XQN=""
W !!,$S(XQDOP:" Removed ",1:" Delegated "),"by ",XQMGR," on ",XQDATE,".",!
S XQ=""
Q
WAIT ;Skip to the head of the next page
I 1 S XQ="" R:IOST["C-" !?26,"Press RETURN to continue,'^' to quit.",XQ:DTIME S:'$T XQ=U W @IOF
Q
;
OUT K DIC,DIK,DA,DISYS,DINUM,POP,XQ,XQH,XQI,XQJ,XQK,XQL,XQM,XQN,XQT,XQON0,XQAL,XQDATE,XQDEL,XQDESC,XQDT,XQDUZ,XQLEV,XQLK,XQMG,XQMGR,XQNAM,XQNGO,XQUF,XQPRO,XQSTART,XQEND,XQHOLD,XQKEY,ZTSK,X,Y,XY,%,^TMP($J)
K ZTRTN,ZTDTH,ZTIO,ZTDESC,ZTSAVE,XQDOP,C,XQU1L
Q
XQSMD2 ; SEA/MJM - Secure MenuMan Delegation (Cont.) ;7/3/91 08:42 ;8/21/92 11:58 AM [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;;Jul 10, 1995
+3 SET U="^"
SET XQMG=DUZ
SET XQNGO=0
BUILD ;Put remaining options into Delgate Options File
+1 SET (XQM,XQN)=""
DO LIST
IF XQM=-1!(XQN=-1)
GOTO OUT
+2 IF $Y+2>IOSL
DO WAIT
WRITE !!!,"Ready to ",$SELECT(XQDOP:"remove these options from",1:"delegate these options to")," these people? Y// "
READ XQ:DTIME
IF '$TEST
SET XQ=U
IF XQ=U
GOTO OUT
IF XQ=""
SET XQ="Y"
IF "YyNn"'[XQ
GOTO BUILD
+3 IF XQ["N"!(XQ["n")
WRITE !!,"Fine, you may edit the user or option list, or enter a '^' to quit."
GOTO NAME^XQSMD
+4 IF '$DATA(^TMP($JOB,"OP"))
WRITE !!,"No options found, no action taken.",*7
GOTO OUT
+5 ;
ZTLOAD ;Set up Taskman parameters an queue the request
+1 SET ZTRTN="ZTSK^XQSMD31"
SET ZTDTH=$HOROLOG
SET ZTIO=""
SET (XQDESC,ZTDESC)=XQMGR_" "_$SELECT(XQDOP:"remov",1:"add")_"ing delegated options"
+2 SET ZTSAVE("^TMP($J,")=""
SET ZTSAVE("XQDOP")=""
SET ZTSAVE("XQLEV")=""
SET ZTSAVE("XQHOLD(")=""
SET ZTSAVE("XQPRO")=""
+3 DO ^%ZTLOAD
+4 WRITE !!,"Request to ",$SELECT(XQDOP:"remove",1:"add")," delegated options has been queued, task # ",ZTSK,",",!?5,"named: ",XQDESC,"."
+5 ;
SCAN ;Scan selected options for restrictions and report them
+1 SET XQN=""
+2 FOR XQI=0:0
IF $Y+3>IOSL
DO WAIT
IF XQ=U
QUIT
SET XQN=$ORDER(^TMP($JOB,"ZN",XQN))
IF XQN=""
QUIT
SET XQON0=^(XQN)
IF $LENGTH($PIECE(XQON0,U,5))
SET XQLK(XQN)=$PIECE(XQON0,U,5)
IF $LENGTH($PIECE(XQON0,U,2))
DO OOO
DO RTIM
IF $LENGTH($PIECE(XQON0,U,9))
DO RDEV
+3 SET XQKEY(0)=""
SET XQN=""
SET DIC=19.1
SET DIC(0)="FMXZ"
SET XQI=0
+4 FOR XQJ=0:0
SET XQN=$ORDER(XQLK(XQN))
IF XQN=""
QUIT
SET X=XQLK(XQN)
DO ^DIC
IF Y>0
IF '$DATA(XQKEY(+Y))
IF $SELECT($DATA(^XUSEC("XUMGR",DUZ)):1,$DATA(^VA(200,DUZ,52,"B",+Y)):1,1:0)
SET XQKEY(+Y)=""
SET XQI=XQI+1
+5 ;
+6 ;Allocate keys for locked options
IF $ORDER(XQKEY(0))'=""
DO KEYS^XQSMD21
+7 ;
+8 GOTO OUT
+9 QUIT
+10 ;
OOO WRITE !,XQN," is out of order with the string: '",$PIECE(XQON0,U,2),"'"
QUIT
+1 ;
RTIM ; Identify and display prohibited times for option
+1 SET %A=""
SET XQON=$ORDER(^DIC(19,"B",XQN,0))
IF $DATA(^DIC(19,XQON,3.91))
FOR %XQI=0:0
SET %XQI=$ORDER(^DIC(19,XQON,3.91,%XQI))
IF %XQI'>0
QUIT
WRITE !,XQN," is PROHIBITED during the times ",$PIECE(^(%XQI,0),U,1),$PIECE(^(0),U,2)," (military time)."
KILL %A
+2 KILL %XQI
IF $DATA(%A)
KILL %A
IF $LENGTH($PIECE(XQON0,U,8))
WRITE !,XQN," is PROHIBITED during the times ",$PIECE(XQON0,U,8)," (military time)."
+3 QUIT
+4 ;
RDEV WRITE !,XQN," is restricted to run on only certain devices."
QUIT
+1 ;
LIST ;List users and options selected so far.
+1 WRITE @IOF
SET (XQT,XQM)=0
SET XQM=$ORDER(XQHOLD(XQM))
IF XQM=""
WRITE !!," No users selected yet."
SET XQM=-1
QUIT
+2 WRITE !!,"For the following user(s):",!
+3 FOR XQI=1:1
IF $Y+2>IOSL
DO WAIT
IF XQ=U
QUIT
IF '(XQT#2)
WRITE !
WRITE ?(XQT#2*35),XQI,". ",XQHOLD(XQM)
SET XQT=XQT+1
SET XQM=$ORDER(XQHOLD(XQM))
IF XQM=""
QUIT
+4 WRITE !!,"You will ",$SELECT(XQDOP:"remove ",1:"delegate "),"the following options: ",!
+5 SET XQT=0
SET XQN=""
SET XQN=$ORDER(^TMP($JOB,"ZN",XQN))
IF XQN=""
WRITE !!,"No menu options selected yet"
SET XQN=-1
QUIT
+6 FOR XQI=0:0
IF $Y+2>IOSL
DO WAIT
IF XQ=U
QUIT
WRITE !,XQN," ",$PIECE(^TMP($JOB,"ZN",XQN),U,1)
SET XQN=$ORDER(^(XQN))
IF XQN=""
QUIT
+7 WRITE !!,$SELECT(XQDOP:" Removed ",1:" Delegated "),"by ",XQMGR," on ",XQDATE,".",!
+8 SET XQ=""
+9 QUIT
WAIT ;Skip to the head of the next page
+1 IF 1
SET XQ=""
IF IOST["C-"
READ !?26,"Press RETURN to continue,'^' to quit.",XQ:DTIME
IF '$TEST
SET XQ=U
WRITE @IOF
+2 QUIT
+3 ;
OUT KILL DIC,DIK,DA,DISYS,DINUM,POP,XQ,XQH,XQI,XQJ,XQK,XQL,XQM,XQN,XQT,XQON0,XQAL,XQDATE,XQDEL,XQDESC,XQDT,XQDUZ,XQLEV,XQLK,XQMG,XQMGR,XQNAM,XQNGO,XQUF,XQPRO,XQSTART,XQEND,XQHOLD,XQKEY,ZTSK,X,Y,XY,%,^TMP($JOB)
+1 KILL ZTRTN,ZTDTH,ZTIO,ZTDESC,ZTSAVE,XQDOP,C,XQU1L
+2 QUIT