BUSAOPT ;GDIT/HS/ALA-Security Audit Menu ; 06 Mar 2013 1:52 PM
;;1.0;IHS USER SECURITY AUDIT;;Nov 05, 2013;Build 65
;
EN ;EP - Entry point
NEW BUS,CT,TYP,VALUE,DATA,DIR,X,Y,SWIT,COMM,IEN,CURR,PREV,DIRUT,DUOUT,DTOUT
S BUS(1)="Current Security Audit Settings:",CT=1
;
F TYP="M","B","C","W" D
. S VALUE=$$STATUS(TYP),DATA(TYP)=VALUE
. S CT=CT+1,BUS(CT,"F")="!?5",BUS(CT)=$P(VALUE,U,2)
. S CT=CT+1,BUS(CT,"F")="?20",BUS(CT)="Status:"
. S CT=CT+1,BUS(CT,"F")="?35",BUS(CT)=$P(VALUE,U,3)
. S CT=CT+1,BUS(CT,"F")="!?20",BUS(CT)="Date Logged:"
. S CT=CT+1,BUS(CT,"F")="?35",BUS(CT)=$P(VALUE,U,4)
. S CT=CT+1,BUS(CT,"F")="!?20",BUS(CT)="User Logged:"
. S CT=CT+1,BUS(CT,"F")="?35",BUS(CT)=$P(VALUE,U,5)
. I $P(VALUE,U,6)'="" D
.. S CT=CT+1,BUS(CT,"F")="!?11",BUS(CT)="Disabled Comment:"
.. S CT=CT+1,BUS(CT,"F")="?25",BUS(CT)=$P(VALUE,U,6)
D EN^DDIOL(.BUS)
K BUS
;
K DIR
S DIR(0)="S^M:Master;B:BMXNet;C:CIA Broker;W:XWB Broker",DIR("A")="Select Switch"
D ^DIR I $G(DIRUT)!($G(DUOUT))!($G(DTOUT)) Q
S SWIT=Y
;
K DIR
S DIR(0)="S^1:On;0:Disabled",DIR("A")="Change Status"
S IEN=$P(DATA(SWIT),U,7),DIR("B")=$$GET1^DIQ(9002319.04,IEN_",",.02,"E"),PREV=$$GET1^DIQ(9002319.04,IEN_",",.02,"I")
D ^DIR I $G(DIRUT)!($G(DUOUT))!($G(DTOUT)) Q
S CURR=Y
I CURR'=PREV D
. I CURR=0 D
.. K DIR
.. S DIR(0)="F^3:120",DIR("A")="Disable Comment"
.. D ^DIR I $G(DIRUT)!($G(DUOUT)) Q
.. S COMM=Y
. D NREC(SWIT,CURR,$G(COMM))
Q
;
STATUS(BTYP) ;EP
NEW DTM,IEN,RESULT
S DTM=$O(^BUSA(9002319.04,"C",BTYP,""),-1)
S IEN=""
I DTM'="" S IEN=$O(^BUSA(9002319.04,"C",BTYP,DTM,""))
S RESULT=$$GET1^DIQ(9002319.04,IEN_",",.02,"I")_U_$$GET1^DIQ(9002319.04,IEN_",",.01,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.02,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.03,"E")_U
S RESULT=RESULT_$$GET1^DIQ(9002319.04,IEN_",",.04,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.05,"E")_U_IEN
Q RESULT
;
NREC(SWIT,CURR,COMM) ;EP - New record
;
;Mark the link as ON/OFF
NEW DIC,X,DLAYGO,DA,BUSAUP,DESC,STS,ESWIT
S DIC="^BUSA(9002319.04,",DIC(0)="L",DLAYGO=9002319.04,X=SWIT
K DO,DD D FILE^DICN
S DA=+Y
S BUSAUP(9002319.04,DA_",",.02)=CURR
S BUSAUP(9002319.04,DA_",",.05)=$G(COMM)
D FILE^DIE("","BUSAUP","ERROR")
;
;Now log the event in the audit log
S ESWIT=$S(SWIT="M":"Master",SWIT="B":"BMXNet",SWIT="C":"CIA Broker",SWIT="W":"XWB Broker",1:"")
S DESC=ESWIT_" Switch "_$S(CURR=1:"turned on",1:"disabled")
S STS=$$BYPSLOG^BUSAAPI("A","S","","BUSA SECURITY EDIT Option",DESC,"")
Q
;
USER ;EP - Set up users for BUSA Reporting Tool access
;
I $G(DUZ)="" W !,"DUZ MUST BE DEFINED BEFORE CALLING THIS OPTION" Q
;
NEW DIR,DIROUT,DTOUT,DUOUT,DZ,GL,I,IDZ,UGL,UID,USERCL,STATUS,%,EXEC
;
PROMPT ;Display current users
S EXEC="S GL=$NA(^BUSA.UsersI(""StatusUserIdx"",""A""))" X EXEC
S EXEC="S UGL=$NA(^BUSA.UsersI(""UserIdx""))" X EXEC
S DZ="" F I=1:1 S DZ=$O(@GL@(DZ)) Q:DZ="" D
. I I=1 W !!,"Current approved BUSA Reporting Users",!
. W !,$$GET1^DIQ(200,$TR(DZ," ")_",",.01,"E")
;
W !!,"Enter the user to add/delete BUSA Reporting Access for",!
;
S DIR(0)="POr^200:EM"
S DIR("A")="User"
D ^DIR
I $D(DIROUT)!($D(DTOUT))!($D(DUOUT))!(Y=-1) Q
;
S IDZ=" "_+Y
;
;Add user
I '$D(@UGL@(IDZ)) D G PROMPT
. NEW USERCL,%,STS
. S EXEC="S USERCL=##CLASS(BUSA.Users).%New()" X EXEC
. S EXEC="S USERCL.User=+Y" X EXEC
. S EXEC="S USERCL.LastModifiedBy=DUZ" X EXEC
. D NOW^%DTC
. S EXEC="S USERCL.LastModifiedDt=%" X EXEC
. S EXEC="S USERCL.Status=""A""" X EXEC
. S EXEC="S STS=USERCL.%Save()" X EXEC
. I STS=1 W !!,"User set up for BUSA Reporting Access",! H 2
;
;Process existing user
;
S UID=$O(@UGL@(IDZ,"")) Q:UID=""
;
;Get user's status
S EXEC="S USERCL=##class(BUSA.Users).%OpenId(UID,1)" X EXEC
S EXEC="S STATUS=USERCL.Status" X EXEC
;
;If Active, make Inactive
I STATUS="A" D G PROMPT
. NEW DIR,DIROUT,DTOUT,DUOUT,Y,X,STS,%
. S DIR(0)="Y"
. S DIR("A")="User is currently an Active BUSA Auditing User. Make them Inactive"
. D ^DIR
. I $D(DIROUT)!($D(DTOUT))!($D(DUOUT))!(Y=-1) Q
. I +Y<1 Q
. S EXEC="S USERCL.LastModifiedBy=DUZ" X EXEC
. D NOW^%DTC
. S EXEC="S USERCL.LastModifiedDt=%" X EXEC
. S EXEC="S USERCL.Status=""I""" X EXEC
. S EXEC="S STS=USERCL.%Save()" X EXEC
. W !!,"User's BUSA Auditing status has been set to Inactive" H 2
;
I STATUS="I" D G PROMPT
. NEW DIR,DIROUT,DTOUT,DUOUT,Y,X,STS,%
. S DIR(0)="Y"
. S DIR("A")="User is currently an Inactive BUSA Auditing User. Make them Active again"
. D ^DIR
. I $D(DIROUT)!($D(DTOUT))!($D(DUOUT))!(Y=-1) Q
. I +Y<1 Q
. S EXEC="S USERCL.LastModifiedBy=DUZ" X EXEC
. D NOW^%DTC
. S EXEC="S USERCL.LastModifiedDt=%" X EXEC
. S EXEC="S USERCL.Status=""A""" X EXEC
. S EXEC="S STS=USERCL.%Save()" X EXEC
. W !!,"User's BUSA Auditing status has been set to Active" H 2
Q
BUSAOPT ;GDIT/HS/ALA-Security Audit Menu ; 06 Mar 2013 1:52 PM
+1 ;;1.0;IHS USER SECURITY AUDIT;;Nov 05, 2013;Build 65
+2 ;
EN ;EP - Entry point
+1 NEW BUS,CT,TYP,VALUE,DATA,DIR,X,Y,SWIT,COMM,IEN,CURR,PREV,DIRUT,DUOUT,DTOUT
+2 SET BUS(1)="Current Security Audit Settings:"
SET CT=1
+3 ;
+4 FOR TYP="M","B","C","W"
Begin DoDot:1
+5 SET VALUE=$$STATUS(TYP)
SET DATA(TYP)=VALUE
+6 SET CT=CT+1
SET BUS(CT,"F")="!?5"
SET BUS(CT)=$PIECE(VALUE,U,2)
+7 SET CT=CT+1
SET BUS(CT,"F")="?20"
SET BUS(CT)="Status:"
+8 SET CT=CT+1
SET BUS(CT,"F")="?35"
SET BUS(CT)=$PIECE(VALUE,U,3)
+9 SET CT=CT+1
SET BUS(CT,"F")="!?20"
SET BUS(CT)="Date Logged:"
+10 SET CT=CT+1
SET BUS(CT,"F")="?35"
SET BUS(CT)=$PIECE(VALUE,U,4)
+11 SET CT=CT+1
SET BUS(CT,"F")="!?20"
SET BUS(CT)="User Logged:"
+12 SET CT=CT+1
SET BUS(CT,"F")="?35"
SET BUS(CT)=$PIECE(VALUE,U,5)
+13 IF $PIECE(VALUE,U,6)'=""
Begin DoDot:2
+14 SET CT=CT+1
SET BUS(CT,"F")="!?11"
SET BUS(CT)="Disabled Comment:"
+15 SET CT=CT+1
SET BUS(CT,"F")="?25"
SET BUS(CT)=$PIECE(VALUE,U,6)
End DoDot:2
End DoDot:1
+16 DO EN^DDIOL(.BUS)
+17 KILL BUS
+18 ;
+19 KILL DIR
+20 SET DIR(0)="S^M:Master;B:BMXNet;C:CIA Broker;W:XWB Broker"
SET DIR("A")="Select Switch"
+21 DO ^DIR
IF $GET(DIRUT)!($GET(DUOUT))!($GET(DTOUT))
QUIT
+22 SET SWIT=Y
+23 ;
+24 KILL DIR
+25 SET DIR(0)="S^1:On;0:Disabled"
SET DIR("A")="Change Status"
+26 SET IEN=$PIECE(DATA(SWIT),U,7)
SET DIR("B")=$$GET1^DIQ(9002319.04,IEN_",",.02,"E")
SET PREV=$$GET1^DIQ(9002319.04,IEN_",",.02,"I")
+27 DO ^DIR
IF $GET(DIRUT)!($GET(DUOUT))!($GET(DTOUT))
QUIT
+28 SET CURR=Y
+29 IF CURR'=PREV
Begin DoDot:1
+30 IF CURR=0
Begin DoDot:2
+31 KILL DIR
+32 SET DIR(0)="F^3:120"
SET DIR("A")="Disable Comment"
+33 DO ^DIR
IF $GET(DIRUT)!($GET(DUOUT))
QUIT
+34 SET COMM=Y
End DoDot:2
+35 DO NREC(SWIT,CURR,$GET(COMM))
End DoDot:1
+36 QUIT
+37 ;
STATUS(BTYP) ;EP
+1 NEW DTM,IEN,RESULT
+2 SET DTM=$ORDER(^BUSA(9002319.04,"C",BTYP,""),-1)
+3 SET IEN=""
+4 IF DTM'=""
SET IEN=$ORDER(^BUSA(9002319.04,"C",BTYP,DTM,""))
+5 SET RESULT=$$GET1^DIQ(9002319.04,IEN_",",.02,"I")_U_$$GET1^DIQ(9002319.04,IEN_",",.01,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.02,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.03,"E")_U
+6 SET RESULT=RESULT_$$GET1^DIQ(9002319.04,IEN_",",.04,"E")_U_$$GET1^DIQ(9002319.04,IEN_",",.05,"E")_U_IEN
+7 QUIT RESULT
+8 ;
NREC(SWIT,CURR,COMM) ;EP - New record
+1 ;
+2 ;Mark the link as ON/OFF
+3 NEW DIC,X,DLAYGO,DA,BUSAUP,DESC,STS,ESWIT
+4 SET DIC="^BUSA(9002319.04,"
SET DIC(0)="L"
SET DLAYGO=9002319.04
SET X=SWIT
+5 KILL DO,DD
DO FILE^DICN
+6 SET DA=+Y
+7 SET BUSAUP(9002319.04,DA_",",.02)=CURR
+8 SET BUSAUP(9002319.04,DA_",",.05)=$GET(COMM)
+9 DO FILE^DIE("","BUSAUP","ERROR")
+10 ;
+11 ;Now log the event in the audit log
+12 SET ESWIT=$SELECT(SWIT="M":"Master",SWIT="B":"BMXNet",SWIT="C":"CIA Broker",SWIT="W":"XWB Broker",1:"")
+13 SET DESC=ESWIT_" Switch "_$SELECT(CURR=1:"turned on",1:"disabled")
+14 SET STS=$$BYPSLOG^BUSAAPI("A","S","","BUSA SECURITY EDIT Option",DESC,"")
+15 QUIT
+16 ;
USER ;EP - Set up users for BUSA Reporting Tool access
+1 ;
+2 IF $GET(DUZ)=""
WRITE !,"DUZ MUST BE DEFINED BEFORE CALLING THIS OPTION"
QUIT
+3 ;
+4 NEW DIR,DIROUT,DTOUT,DUOUT,DZ,GL,I,IDZ,UGL,UID,USERCL,STATUS,%,EXEC
+5 ;
PROMPT ;Display current users
+1 SET EXEC="S GL=$NA(^BUSA.UsersI(""StatusUserIdx"",""A""))"
XECUTE EXEC
+2 SET EXEC="S UGL=$NA(^BUSA.UsersI(""UserIdx""))"
XECUTE EXEC
+3 SET DZ=""
FOR I=1:1
SET DZ=$ORDER(@GL@(DZ))
IF DZ=""
QUIT
Begin DoDot:1
+4 IF I=1
WRITE !!,"Current approved BUSA Reporting Users",!
+5 WRITE !,$$GET1^DIQ(200,$TRANSLATE(DZ," ")_",",.01,"E")
End DoDot:1
+6 ;
+7 WRITE !!,"Enter the user to add/delete BUSA Reporting Access for",!
+8 ;
+9 SET DIR(0)="POr^200:EM"
+10 SET DIR("A")="User"
+11 DO ^DIR
+12 IF $DATA(DIROUT)!($DATA(DTOUT))!($DATA(DUOUT))!(Y=-1)
QUIT
+13 ;
+14 SET IDZ=" "_+Y
+15 ;
+16 ;Add user
+17 IF '$DATA(@UGL@(IDZ))
Begin DoDot:1
+18 NEW USERCL,%,STS
+19 SET EXEC="S USERCL=##CLASS(BUSA.Users).%New()"
XECUTE EXEC
+20 SET EXEC="S USERCL.User=+Y"
XECUTE EXEC
+21 SET EXEC="S USERCL.LastModifiedBy=DUZ"
XECUTE EXEC
+22 DO NOW^%DTC
+23 SET EXEC="S USERCL.LastModifiedDt=%"
XECUTE EXEC
+24 SET EXEC="S USERCL.Status=""A"""
XECUTE EXEC
+25 SET EXEC="S STS=USERCL.%Save()"
XECUTE EXEC
+26 IF STS=1
WRITE !!,"User set up for BUSA Reporting Access",!
HANG 2
End DoDot:1
GOTO PROMPT
+27 ;
+28 ;Process existing user
+29 ;
+30 SET UID=$ORDER(@UGL@(IDZ,""))
IF UID=""
QUIT
+31 ;
+32 ;Get user's status
+33 SET EXEC="S USERCL=##class(BUSA.Users).%OpenId(UID,1)"
XECUTE EXEC
+34 SET EXEC="S STATUS=USERCL.Status"
XECUTE EXEC
+35 ;
+36 ;If Active, make Inactive
+37 IF STATUS="A"
Begin DoDot:1
+38 NEW DIR,DIROUT,DTOUT,DUOUT,Y,X,STS,%
+39 SET DIR(0)="Y"
+40 SET DIR("A")="User is currently an Active BUSA Auditing User. Make them Inactive"
+41 DO ^DIR
+42 IF $DATA(DIROUT)!($DATA(DTOUT))!($DATA(DUOUT))!(Y=-1)
QUIT
+43 IF +Y<1
QUIT
+44 SET EXEC="S USERCL.LastModifiedBy=DUZ"
XECUTE EXEC
+45 DO NOW^%DTC
+46 SET EXEC="S USERCL.LastModifiedDt=%"
XECUTE EXEC
+47 SET EXEC="S USERCL.Status=""I"""
XECUTE EXEC
+48 SET EXEC="S STS=USERCL.%Save()"
XECUTE EXEC
+49 WRITE !!,"User's BUSA Auditing status has been set to Inactive"
HANG 2
End DoDot:1
GOTO PROMPT
+50 ;
+51 IF STATUS="I"
Begin DoDot:1
+52 NEW DIR,DIROUT,DTOUT,DUOUT,Y,X,STS,%
+53 SET DIR(0)="Y"
+54 SET DIR("A")="User is currently an Inactive BUSA Auditing User. Make them Active again"
+55 DO ^DIR
+56 IF $DATA(DIROUT)!($DATA(DTOUT))!($DATA(DUOUT))!(Y=-1)
QUIT
+57 IF +Y<1
QUIT
+58 SET EXEC="S USERCL.LastModifiedBy=DUZ"
XECUTE EXEC
+59 DO NOW^%DTC
+60 SET EXEC="S USERCL.LastModifiedDt=%"
XECUTE EXEC
+61 SET EXEC="S USERCL.Status=""A"""
XECUTE EXEC
+62 SET EXEC="S STS=USERCL.%Save()"
XECUTE EXEC
+63 WRITE !!,"User's BUSA Auditing status has been set to Active"
HANG 2
End DoDot:1
GOTO PROMPT
+64 QUIT