AKMOSKEY ;OHPD-TUCSON/BRJ ASSIGN NAMESPACE SECURITY KEYS TO USERS [ 04/22/93 10:41 AM ]
;;2.0;IHS KERNEL UTILITIES;;JUN 28, 1993
EN ; ENTRY TO PROGRAM
X "ZL @""XUS"" S AKMO(""KERNEL VERSION"")=$P($T(+2),"";"",3)"
I AKMO("KERNEL VERSION")<7 W !!,*7,"You are running Kernel ",AKMO("KERNEL VERSION"),". This program requires Kernel 7.0 or later version!",!!,"No action taken!!",! K AKMO Q
D ^XBKSET
W !,"I'm ready to assign security keys but. . .",!,"Please note - the POSTMASTER will be the assignee.",!
S DUZ(0)="@"
S X="T",%DT="" D ^%DT S AKMO("DATE")=Y
GETNSP ; Get security key namespaces
F D Q:AKMO("NO MORE KEYS")
. S AKMO("NO MORE KEYS")=1
. F R !,?10,"Enter Security Key namespace : // ",AKMO("KEYNSP") Q:"^"[AKMO("KEYNSP") D Q:$D(AKMO("KEY TBL","*"))
.. I AKMO("KEYNSP")?1"?".E W !!,?5,"Enter the leading characters of the package namespace.",!,?15,"Ex: APCD for PCC Data Entry ",!,?5,"OR - to select all keys, enter an asterisk (*).",! Q
.. I AKMO("KEYNSP")?1"*".E D Q
... W !!,"Selecting ALL security keys supercedes previously selected namespace, if any, for this iteration."
... W !!,*7,"Do you really want to assign all security keys at this time"
... S %=1 D YN^DICN
... Q:%'=1
... W !!,"O.K.",!
... K AKMO("KEY TBL")
... S AKMO("KEY TBL","*")=""
... S AKMO("NO MORE KEYS")=0
.. S AKMO("KEY")=$O(^DIC(19.1,"B",AKMO("KEYNSP")))
.. I AKMO("KEYNSP")'=$E(AKMO("KEY"),1,$L(AKMO("KEYNSP"))) W !,*7,?10,"The ",AKMO("KEYNSP")," namespace does not have any security keys!",! Q
.. S AKMO("KEY TBL",AKMO("KEYNSP"))=""
.. S AKMO("NO MORE KEYS")=0
GETUSER . ;
. Q:AKMO("NO MORE KEYS")
. S DIC="^VA(200,"
. S DIC("A")="Enter User Name to be assigned keys: // "
. S DIC(0)="AEMQ"
. F W ! D ^DIC Q:"^"[X D
.. S AKMO("KEYNSP")=""
.. F S AKMO("KEYNSP")=$O(AKMO("KEY TBL",AKMO("KEYNSP"))) Q:AKMO("KEYNSP")="" S AKMO("KEY TBL",AKMO("KEYNSP"),X,$P(Y,U))=""
. S AKMO("NO MORE KEYS")=1
ASSGNLP ; LOOP DOWN AKMO("KEY TBL","KEYNSP",holder) and assign the security keys
;Q
W !!,"Assigning security keys. . . ",!
S AKMO("KEYNSP")=""
F S AKMO("KEYNSP")=$O(AKMO("KEY TBL",AKMO("KEYNSP"))) Q:AKMO("KEYNSP")="" D
. S AKMO("HOLDER")=""
. F S AKMO("HOLDER")=$O(AKMO("KEY TBL",AKMO("KEYNSP"),AKMO("HOLDER"))) Q:AKMO("HOLDER")="" D
.. S AKMO("HOLDER DFN")=$O(AKMO("KEY TBL",AKMO("KEYNSP"),AKMO("HOLDER"),""))
.. S AKMO("KEY")=AKMO("KEYNSP")
.. F S AKMO("KEY")=$O(^DIC(19.1,"B",AKMO("KEY"))) D Q:AKMO("KEY")=""
... Q:AKMO("KEY")=""
... I AKMO("KEYNSP")'="*",$E(AKMO("KEY"),1,$L(AKMO("KEYNSP")))'=AKMO("KEYNSP") S AKMO("KEY")="" Q
... S AKMO("KEY DFN")=$O(^DIC(19.1,"B",AKMO("KEY"),""))
... I $D(^VA(200,AKMO("HOLDER DFN"),51,AKMO("KEY DFN"))) W !,AKMO("KEY"),?34,"already assigned to <",AKMO("HOLDER"),">." Q
... ; I '$D(^DIC(19.1,"D",DUZ,AKMO("KEY DFN"))) W !,AKMO("KEY"),?30,"Denied! You are not allowed to assign this key." Q
ASSGNKEY ... ; ASSIGN KEY USING DIC AND DIE CALLS
... S DIE="^VA(200,",DA=AKMO("HOLDER DFN"),DR="51///`"_AKMO("KEY DFN")
... S DR(2,200.051)="1////.5;2////"_AKMO("DATE")_";3////"_AKMO("DATE")
... D ^DIE
... K DIE,DR,DA
... I $D(Y) W !!,*7,"FileManager error condition returned from ^DIE call while updating",!,?3,AKMO("KEY")," security key for ",AKMO("HOLDER"),!,?3,"Security key was not assigned." Q
... W !,AKMO("KEY"),?42,"assigned to <",AKMO("HOLDER"),">."
XIT ;
I '$D(AKMO("KEY TBL")) W !!,*7,"No selection of security keys made. B y e . . . .",!
W !!,*7,?12,"<DONE>"
KILL ; KILL VARIABLES
K AKMO,Y,%DT,DIC,DIE,DUZ,DA,DR,DT,X
Q
AKMOSKEY ;OHPD-TUCSON/BRJ ASSIGN NAMESPACE SECURITY KEYS TO USERS [ 04/22/93 10:41 AM ]
+1 ;;2.0;IHS KERNEL UTILITIES;;JUN 28, 1993
EN ; ENTRY TO PROGRAM
+1 XECUTE "ZL @""XUS"" S AKMO(""KERNEL VERSION"")=$P($T(+2),"";"",3)"
+2 IF AKMO("KERNEL VERSION")<7
WRITE !!,*7,"You are running Kernel ",AKMO("KERNEL VERSION"),". This program requires Kernel 7.0 or later version!",!!,"No action taken!!",!
KILL AKMO
QUIT
+3 DO ^XBKSET
+4 WRITE !,"I'm ready to assign security keys but. . .",!,"Please note - the POSTMASTER will be the assignee.",!
+5 SET DUZ(0)="@"
+6 SET X="T"
SET %DT=""
DO ^%DT
SET AKMO("DATE")=Y
GETNSP ; Get security key namespaces
+1 FOR
Begin DoDot:1
+2 SET AKMO("NO MORE KEYS")=1
+3 FOR
READ !,?10,"Enter Security Key namespace : // ",AKMO("KEYNSP")
IF "^"[AKMO("KEYNSP")
QUIT
Begin DoDot:2
+4 IF AKMO("KEYNSP")?1"?".E
WRITE !!,?5,"Enter the leading characters of the package namespace.",!,?15,"Ex: APCD for PCC Data Entry ",!,?5,"OR - to select all keys, enter an asterisk (*).",!
QUIT
+5 IF AKMO("KEYNSP")?1"*".E
Begin DoDot:3
+6 WRITE !!,"Selecting ALL security keys supercedes previously selected namespace, if any, for this iteration."
+7 WRITE !!,*7,"Do you really want to assign all security keys at this time"
+8 SET %=1
DO YN^DICN
+9 IF %'=1
QUIT
+10 WRITE !!,"O.K.",!
+11 KILL AKMO("KEY TBL")
+12 SET AKMO("KEY TBL","*")=""
+13 SET AKMO("NO MORE KEYS")=0
End DoDot:3
QUIT
+14 SET AKMO("KEY")=$ORDER(^DIC(19.1,"B",AKMO("KEYNSP")))
+15 IF AKMO("KEYNSP")'=$EXTRACT(AKMO("KEY"),1,$LENGTH(AKMO("KEYNSP")))
WRITE !,*7,?10,"The ",AKMO("KEYNSP")," namespace does not have any security keys!",!
QUIT
+16 SET AKMO("KEY TBL",AKMO("KEYNSP"))=""
+17 SET AKMO("NO MORE KEYS")=0
End DoDot:2
IF $DATA(AKMO("KEY TBL","*"))
QUIT
GETUSER ;
+1 IF AKMO("NO MORE KEYS")
QUIT
+2 SET DIC="^VA(200,"
+3 SET DIC("A")="Enter User Name to be assigned keys: // "
+4 SET DIC(0)="AEMQ"
+5 FOR
WRITE !
DO ^DIC
IF "^"[X
QUIT
Begin DoDot:2
+6 SET AKMO("KEYNSP")=""
+7 FOR
SET AKMO("KEYNSP")=$ORDER(AKMO("KEY TBL",AKMO("KEYNSP")))
IF AKMO("KEYNSP")=""
QUIT
SET AKMO("KEY TBL",AKMO("KEYNSP"),X,$PIECE(Y,U))=""
End DoDot:2
+8 SET AKMO("NO MORE KEYS")=1
End DoDot:1
IF AKMO("NO MORE KEYS")
QUIT
ASSGNLP ; LOOP DOWN AKMO("KEY TBL","KEYNSP",holder) and assign the security keys
+1 ;Q
+2 WRITE !!,"Assigning security keys. . . ",!
+3 SET AKMO("KEYNSP")=""
+4 FOR
SET AKMO("KEYNSP")=$ORDER(AKMO("KEY TBL",AKMO("KEYNSP")))
IF AKMO("KEYNSP")=""
QUIT
Begin DoDot:1
+5 SET AKMO("HOLDER")=""
+6 FOR
SET AKMO("HOLDER")=$ORDER(AKMO("KEY TBL",AKMO("KEYNSP"),AKMO("HOLDER")))
IF AKMO("HOLDER")=""
QUIT
Begin DoDot:2
+7 SET AKMO("HOLDER DFN")=$ORDER(AKMO("KEY TBL",AKMO("KEYNSP"),AKMO("HOLDER"),""))
+8 SET AKMO("KEY")=AKMO("KEYNSP")
+9 FOR
SET AKMO("KEY")=$ORDER(^DIC(19.1,"B",AKMO("KEY")))
Begin DoDot:3
+10 IF AKMO("KEY")=""
QUIT
+11 IF AKMO("KEYNSP")'="*"
IF $EXTRACT(AKMO("KEY"),1,$LENGTH(AKMO("KEYNSP")))'=AKMO("KEYNSP")
SET AKMO("KEY")=""
QUIT
+12 SET AKMO("KEY DFN")=$ORDER(^DIC(19.1,"B",AKMO("KEY"),""))
+13 IF $DATA(^VA(200,AKMO("HOLDER DFN"),51,AKMO("KEY DFN")))
WRITE !,AKMO("KEY"),?34,"already assigned to <",AKMO("HOLDER"),">."
QUIT
+14 ; I '$D(^DIC(19.1,"D",DUZ,AKMO("KEY DFN"))) W !,AKMO("KEY"),?30,"Denied! You are not allowed to assign this key." Q
ASSGNKEY ; ASSIGN KEY USING DIC AND DIE CALLS
+1 SET DIE="^VA(200,"
SET DA=AKMO("HOLDER DFN")
SET DR="51///`"_AKMO("KEY DFN")
+2 SET DR(2,200.051)="1////.5;2////"_AKMO("DATE")_";3////"_AKMO("DATE")
+3 DO ^DIE
+4 KILL DIE,DR,DA
+5 IF $DATA(Y)
WRITE !!,*7,"FileManager error condition returned from ^DIE call while updating",!,?3,AKMO("KEY")," security key for ",AKMO("HOLDER"),!,?3,"Security key was not assigned."
QUIT
+6 WRITE !,AKMO("KEY"),?42,"assigned to <",AKMO("HOLDER"),">."
End DoDot:3
IF AKMO("KEY")=""
QUIT
End DoDot:2
End DoDot:1
XIT ;
+1 IF '$DATA(AKMO("KEY TBL"))
WRITE !!,*7,"No selection of security keys made. B y e . . . .",!
+2 WRITE !!,*7,?12,"<DONE>"
KILL ; KILL VARIABLES
+1 KILL AKMO,Y,%DT,DIC,DIE,DUZ,DA,DR,DT,X
+2 QUIT