Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AKMOSUSR

AKMOSUSR.m

Go to the documentation of this file.
AKMOSUSR ;BRJ/OHPD/TUCSON ASSIGN ALL SECURITY KEYS TO SUPER USER  [ 04/02/2003   8:51 AM ]
 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
 ;;2.0;IHS KERNEL UTILITIES;;JUN 28, 1993
 ;IHS/MFD fix at ASSGNKEY+3
 ;IHS/MFD,JCM fix to use DIE and work with KERNEL 7
 ;IHS/JLS 10/31/96 fix at EN+1 for version check
 ;IHS/MFD FINDKEY+2, check for provider key so it isn't given out here
 ;IHS/JDM OK+6 THRU 8 AND ASSGNKEY+1 THRU 3, prompt for namespace or 'all' and assign keys per response.
EN ;
 I "20217.18.0"'[+$G(^DD(9.4,0,"VR")) W *7,!,"You must have KERNEL 7/FILEMAN 19 loaded to use this routine!!" Q
 W !,$T(+0),*7,?12,"Please enter the name of your ""SUPER USER"".",!!,?20,"<ADAM,ADAM> // " R AKMOSUSR S AKMOSUSR=$S(AKMOSUSR="":"ADAM,ADAM",1:AKMOSUSR)
 W !,$T(+0),?12,"This program will check the security key file (^DIC(19.1))",!,?12,"and assign all security keys to your ""SUPERUSER""."
 W !!,$T(+0),?12,"OK to continue <Y>es or <N>o?  <No> // " R AKMOANS S AKMOANS=$S(AKMOANS="":"N",1:AKMOANS)
 I '(AKMOANS?1"Y".E!(AKMOANS?1"y".E)) W !!,$T(+0),?12,"That's a NO-GO!!" G XIT
OK ;
 D ^XBKSET S DUZ(0)="@"
 W ! S AKMOXUSR=0,AKMODUZ="" F AKMOL=0:0 S AKMOXUSR=$O(^VA(200,"B",AKMOXUSR)) Q:AKMOXUSR=""  I AKMOXUSR=AKMOSUSR S AKMODUZ=$O(^VA(200,"B",AKMOXUSR,AKMODUZ)) Q
 I '+AKMODUZ W !!,*7,?5,"Cannot continue!!  Superuser <",AKMOSUSR,"> was not found in the USER (^VA(200)) file." G XIT
 D FINDKEYS
 I '+AKMOKDFN W !!,*7,$T(+0),?12,"OOPS - - Your Security Key file (^DIC(19.1)) ""B"" cross reference is missing or incorrect.",!!,?12,$T(+0)," cannot continue.  No action taken!!" G XIT
 K DIR S DIR(0)="F^1:4^K:X'?.U X",DIR("A")="('ALL'=ALL) NAMESPACE? ",DIR("?")="Must enter 3-4 Uppercase Characters" D ^DIR
 I X["^"!($D(DTOUT))!($D(DUOUT)) W !,"ABORTING..." G XIT
 S AKMONSPC=X
 F AKMOL=1:1:AKMOHITX D ASSGNKEY
 W !!,$T(+0),?12,"Superuser <",AKMOSUSR,"> had or was assigned each security key."
XIT ;
 W !!,*7,$T(+0),?12,"<DONE>"
 K AKMOANS,AKMOL,AKMOLAST,AKMOHLDR,AKMOSKEY,AKMOHIT,AKMODT,AKMOXUSR,AKMODUZ,AKMOHITS,AKMOHITX,AKMOKDFN,U,X,Y,%DT
 Q
FINDKEYS ; FIND THE SECURITY KEYS IN ^DIC(19.1,
 S U="^",X="T",(AKMOSKEY,AKMOHITX)=0,(%DT,AKMOKDFN)="" D ^%DT S AKMODT=Y
 ;F AKMOL=0:0 S AKMOSKEY=$O(^DIC(19.1,"B",AKMOSKEY)) Q:AKMOSKEY=""!(AKMOSKEY"PROVIDER")  S AKMOKDFN=$O(^DIC(19.1,"B",AKMOSKEY,"")) Q:'+AKMOKDFN  D FINDHLDR
 F AKMOL=0:0 S AKMOSKEY=$O(^DIC(19.1,"B",AKMOSKEY)) Q:AKMOSKEY=""  S AKMOKDFN=$O(^DIC(19.1,"B",AKMOSKEY,"")) Q:'+AKMOKDFN  D FINDHLDR ;IHS/ORDC/LJF 4/14/94 REMOVED CHECK FOR PROVIDER KEY 
 Q
FINDHLDR ; CHECK TO SEE IF XUSR ALREADY HOLDS THE KEY
 Q:AKMOSKEY="PROVIDER"  ;IHS/ORDC/LJF 4/14/94 don't give provider key to programmers
 I '$D(^VA(200,AKMODUZ,51,AKMOKDFN)) S AKMOHITX=AKMOHITX+1,AKMOHITS(AKMOHITX)=AKMOSKEY_U_AKMOKDFN
 Q
 S (AKMOHLDR,AKMOHIT,AKMOLAST)=0 F AKMOL=0:0 S AKMOHLDR=$O(^VA(200,AKMOKDFN,51,AKMOHLDR)) Q:'+AKMOHLDR  S AKMOLAST=AKMOHLDR I $P(^(AKMOHLDR,0),U,1)=AKMODUZ S AKMOHIT=1 Q
 I 'AKMOHIT S AKMOHITX=AKMOHITX+1,AKMONXT=AKMOLAST+1,AKMOHITS(AKMOHITX)=AKMOSKEY_U_AKMOKDFN_U_AKMONXT
 ;W !,$T(+0),?12,AKMOSKEY,?35,$S(AKMOHIT:" already ",1:" "),"assigned to <",AKMOSUSR,">."  ;IHS/MFD commented out
 Q
ASSGNKEY ; ASSIGN XUSR THIS SECURITY KEY
 S AKMOKNAM=$P(AKMOHITS(AKMOL),"^",2),AKMOKNAM=$P(^DIC(19.1,AKMOKNAM,0),U,1),AKMONSLT=$L(AKMONSPC)
 Q:AKMONSPC'="ALL"&($E(AKMOKNAM,1,AKMONSLT)'=AKMONSPC)
 U IO(0) W !,AKMOSUSR,?30,"  ASSIGNED KEY: ",?50,AKMOKNAM
 S DIE="^VA(200,",DA=AKMODUZ,DR="51///`"_$P(AKMOHITS(AKMOL),"^",2)
 S DR(2,200.051)="1////.5;2////"_AKMODT_";3////"_AKMODT
 D ^DIE K DIE,DR,DA
 Q