ZUA ;SF/LJP - AUDIT ACCESS ;11/17/94 15:07 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
FAA ;Return failed access attempts
K X S X(0)=0 F I=1:1 S X(I)=$O(^%ZUA(3.05,"U",XUF,X(I-1))) Q:X(I)'>0 S %H=$P($H,",",2),$P(^%ZUA(3.05,X(I),0),U,7)=DT_(%H\60#60/100+(%H\3600)+(%H#60/10000)/100)
Q
FAAL ;Record failed access attempts
S Z1=XUNOW
F1 L +^%ZUA(3.05,0) I $D(^%ZUA(3.05,Z1,0)) S Z1=Z1+.000001 G F1
S $P(^(0),"^",3,4)=Z1_"^"_($P(^%ZUA(3.05,0),"^",4)+1)
S ^%ZUA(3.05,Z1,0)=IOS_U_$P(XUVOL,U,1)_U_XUF(.1)_U_XUT_U_$P(XUCI,",",1)_U_XUF(.3)_U_$S($D(IO("ZIO")):IO("ZIO"),1:"") L -^%ZUA(3.05,0)
I XUF=2 F I=1:1:XUF(.2) S ^%ZUA(3.05,Z1,1,I,0)=XUF(I)
;I XUF(.3) S ^%ZUA(3.05,"U",$P(XUVOL,U,1)_","_$P(XUCI,",",1)_","_XUF(.3),Z1)=""
K Z1 Q
PRGM ;Programmer mode log.
S %H=$P($H,",",2),Z1=DT_(%H\60#60/100+(%H\3600)+(%H#60/10000)/100)
P1 L +^%ZUA(3.07,0) I $D(^%ZUA(3.07,Z1,0)) S Z1=Z1+.000001 G P1
S $P(^(0),"^",3,4)=Z1_"^"_($P(^%ZUA(3.07,0),"^",4)+1)
S ^%ZUA(3.07,Z1,0)=DUZ_U_$P(XUCI,",",1)_U_$P(XUVOL,U,1) L -^%ZUA(3.07,0)
K Z1 Q
PURG ;Purge both failed access and programmer mode logs to 30 days.
S X="T-30",%DT="" D ^%DT Q:Y'>0 S BD=2000000,ED=Y
F ZUI=3.05,3.07 S BDATE=BD,EDATE=ED D PRG
K BD,ED
EXIT S:$D(ZTSK) ZTREQ="@" K BDATE,EDATE,REC Q
PMPURG ;Purge programmer mode log.
S ZUI=3.07 D PRG G EXIT
PURGE ;Purge failed access log.
S ZUI=3.05 D PRG G EXIT
PRG S C=0 F REC=BDATE-.000001:0 S REC=$O(^%ZUA(ZUI,REC)) Q:REC'>0!(REC>EDATE) K ^(REC) S C=C+1
L +^%ZUA(ZUI,0) S $P(^(0),"^",4)=$P(^%ZUA(ZUI,0),"^",4)-C L -^%ZUA(ZUI,0) Q
;
ZUA ;SF/LJP - AUDIT ACCESS ;11/17/94 15:07 [ 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
FAA ;Return failed access attempts
+1 KILL X
SET X(0)=0
FOR I=1:1
SET X(I)=$ORDER(^%ZUA(3.05,"U",XUF,X(I-1)))
IF X(I)'>0
QUIT
SET %H=$PIECE($HOROLOG,",",2)
SET $PIECE(^%ZUA(3.05,X(I),0),U,7)=DT_(%H\60#60/100+(%H\3600)+(%H#60/10000)/100)
+2 QUIT
FAAL ;Record failed access attempts
+1 SET Z1=XUNOW
F1 LOCK +^%ZUA(3.05,0)
IF $DATA(^%ZUA(3.05,Z1,0))
SET Z1=Z1+.000001
GOTO F1
+1 SET $PIECE(^(0),"^",3,4)=Z1_"^"_($PIECE(^%ZUA(3.05,0),"^",4)+1)
+2 SET ^%ZUA(3.05,Z1,0)=IOS_U_$PIECE(XUVOL,U,1)_U_XUF(.1)_U_XUT_U_$PIECE(XUCI,",",1)_U_XUF(.3)_U_$SELECT($DATA(IO("ZIO")):IO("ZIO"),1:"")
LOCK -^%ZUA(3.05,0)
+3 IF XUF=2
FOR I=1:1:XUF(.2)
SET ^%ZUA(3.05,Z1,1,I,0)=XUF(I)
+4 ;I XUF(.3) S ^%ZUA(3.05,"U",$P(XUVOL,U,1)_","_$P(XUCI,",",1)_","_XUF(.3),Z1)=""
+5 KILL Z1
QUIT
PRGM ;Programmer mode log.
+1 SET %H=$PIECE($HOROLOG,",",2)
SET Z1=DT_(%H\60#60/100+(%H\3600)+(%H#60/10000)/100)
P1 LOCK +^%ZUA(3.07,0)
IF $DATA(^%ZUA(3.07,Z1,0))
SET Z1=Z1+.000001
GOTO P1
+1 SET $PIECE(^(0),"^",3,4)=Z1_"^"_($PIECE(^%ZUA(3.07,0),"^",4)+1)
+2 SET ^%ZUA(3.07,Z1,0)=DUZ_U_$PIECE(XUCI,",",1)_U_$PIECE(XUVOL,U,1)
LOCK -^%ZUA(3.07,0)
+3 KILL Z1
QUIT
PURG ;Purge both failed access and programmer mode logs to 30 days.
+1 SET X="T-30"
SET %DT=""
DO ^%DT
IF Y'>0
QUIT
SET BD=2000000
SET ED=Y
+2 FOR ZUI=3.05,3.07
SET BDATE=BD
SET EDATE=ED
DO PRG
+3 KILL BD,ED
EXIT IF $DATA(ZTSK)
SET ZTREQ="@"
KILL BDATE,EDATE,REC
QUIT
PMPURG ;Purge programmer mode log.
+1 SET ZUI=3.07
DO PRG
GOTO EXIT
PURGE ;Purge failed access log.
+1 SET ZUI=3.05
DO PRG
GOTO EXIT
PRG SET C=0
FOR REC=BDATE-.000001:0
SET REC=$ORDER(^%ZUA(ZUI,REC))
IF REC'>0!(REC>EDATE)
QUIT
KILL ^(REC)
SET C=C+1
+1 LOCK +^%ZUA(ZUI,0)
SET $PIECE(^(0),"^",4)=$PIECE(^%ZUA(ZUI,0),"^",4)-C
LOCK -^%ZUA(ZUI,0)
QUIT
+2 ;