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

AGGULSC.m

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