AGGULSC ;VNGT/HS/ALA - Security Key Check ; 13 May 2010 6:12 PM
;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
;
;
Q
;
; This function will return information on whether or not a user has a given key.
; The user and the key to be tested are parameters that are passed into the function.
;
; INPUT:
; KEY - The is the key that we are validating under the user's DUZ.
; - This may be passed by IEN or key name.
; DUZ - The DUZ of the user
;
;
; OUTPUT:
; 1 - User has security key
; 0 - User does not have security key
; -1 - Unable to process request (an error has occurred) such as,
; the key does not exist, calling routine should not be checking
; for a key that does not exist.
;
KEYCHK(DATA,KEY) ;EP -- AGG VALIDATE KEY
NEW UID,II
;
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("AGGULSC",UID))
K @DATA
;
S II=0
;
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGVER D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
S @DATA@(II)="I00010RESULT^T00120MSG"_$C(30)
; If security key is not numeric, it is assumed that the key was passed by name.
NEW KEYIEN,VAL,MSG,RESULT
S VAL=1,MSG=""
I KEY'?1N.N D
. I '$D(^DIC(19.1,"B",KEY)) S VAL=-1,MSG="Key does not exist" Q
. S KEYIEN=$O(^DIC(19.1,"B",KEY,0))
. I '$D(^VA(200,DUZ,51,KEYIEN)) S VAL=-1 Q
. S VAL=1
I VAL'=1,'$D(^XUSEC(KEY,DUZ)) S VAL=-1,MSG="User does not have key "_KEY
S RESULT=VAL_U_MSG
S II=II+1,@DATA@(II)=RESULT_$C(30)
S II=II+1,@DATA@(II)=$C(31)
Q
AGGULSC ;VNGT/HS/ALA - Security Key Check ; 13 May 2010 6:12 PM
+1 ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
+2 ;
+3 ;
+4 QUIT
+5 ;
+6 ; This function will return information on whether or not a user has a given key.
+7 ; The user and the key to be tested are parameters that are passed into the function.
+8 ;
+9 ; INPUT:
+10 ; KEY - The is the key that we are validating under the user's DUZ.
+11 ; - This may be passed by IEN or key name.
+12 ; DUZ - The DUZ of the user
+13 ;
+14 ;
+15 ; OUTPUT:
+16 ; 1 - User has security key
+17 ; 0 - User does not have security key
+18 ; -1 - Unable to process request (an error has occurred) such as,
+19 ; the key does not exist, calling routine should not be checking
+20 ; for a key that does not exist.
+21 ;
KEYCHK(DATA,KEY) ;EP -- AGG VALIDATE KEY
+1 NEW UID,II
+2 ;
+3 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+4 SET DATA=$NAME(^TMP("AGGULSC",UID))
+5 KILL @DATA
+6 ;
+7 SET II=0
+8 ;
+9 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^AGGVER D UNWIND^%ZTER"
+10 SET @DATA@(II)="I00010RESULT^T00120MSG"_$CHAR(30)
+11 ; If security key is not numeric, it is assumed that the key was passed by name.
+12 NEW KEYIEN,VAL,MSG,RESULT
+13 SET VAL=1
SET MSG=""
+14 IF KEY'?1N.N
Begin DoDot:1
+15 IF '$DATA(^DIC(19.1,"B",KEY))
SET VAL=-1
SET MSG="Key does not exist"
QUIT
+16 SET KEYIEN=$ORDER(^DIC(19.1,"B",KEY,0))
+17 IF '$DATA(^VA(200,DUZ,51,KEYIEN))
SET VAL=-1
QUIT
+18 SET VAL=1
End DoDot:1
+19 IF VAL'=1
IF '$DATA(^XUSEC(KEY,DUZ))
SET VAL=-1
SET MSG="User does not have key "_KEY
+20 SET RESULT=VAL_U_MSG
+21 SET II=II+1
SET @DATA@(II)=RESULT_$CHAR(30)
+22 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+23 QUIT