Changeset 636 for FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XQCHK.m
- Timestamp:
- Dec 4, 2009, 8:26:01 PM (14 years ago)
- Location:
- FOIAVistA/tag/r
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XQCHK.m
r628 r636 1 XQCHK ; SEA/MJM - Check security on option # XQCY ;5/20/08 2 ;;8.0;KERNEL;**47,110,149,303,427,503**;Jul 10, 1995;Build 2 3 ;;"Per VHA Directive 2004-038, this routine should not be modified". 4 ; 1 XQCHK ; SEA/MJM - Check security on option # XQCY ; [7/19/06 10:45am] 2 ;;8.0;KERNEL;**47,110,149,303,427**;Jul 10, 1995;Build 3 5 3 Q:'$D(XQCY)!(XQCY<1) S:'$D(XQJMP) XQJMP=0 6 4 I '$D(XQY0) S XQY0=^DIC(19,+XQCY,0) … … 18 16 Q 19 17 ; 20 OUT K %,%XQI,XQCY0,%Y,XQZ 18 OUT ;I XQCY=-2 W !,"Locked...Do you have the key "_$P(XQRT,"^",2) 19 ;I XQCY=-3 W !,"Reversed Locked...Don't you have the key "_$P(XQRT,"^",2) 20 K %,%XQI,XQCY0,%Y,XQZ 21 21 Q 22 22 ; … … 67 67 Q % 68 68 ; 69 ; 69 70 ACCESS(%XQUSR,%XQOP) ;Find out if a user has access to a particular option 70 Q $$ACCESS^XQCHK3(%XQUSR,%XQOP) 71 ; 72 ; W $$ACCESS(DUZ,Option IEN) returns: 73 ; 74 ;-1:no such user in the New Person File 75 ;-2: User terminated or has no access code 76 ;-3: no such option in the Option File 77 ;0: no access found in any menu tree the user owns 78 ; 79 ; All other cases return a 4-piece string stating 80 ; access ^ menu tree IEN ^ a set of codes ^ key 81 ; 82 ;O^tree^codes^key: No access because of locks (see XQCODES below) 83 ; where 'tree' is the menu where access WOULD be allowed 84 ; and 'key' is the key preventing access 85 ;1^OpIEN^^: Access allowed through Primary Menu 86 ;2^OpIEN^codes^: Access found in the Common Options 87 ;3^OpIEN^codes^: Access found in top level of secondary option 88 ;4^OpIEN^codes^: Access through a the secondary menu tree OpIEN. 89 ; 90 ;XQCODES can contain: 91 ; N=No Primary Menu in the User File (warning only) 92 ; L=Locked and the user does not have the key (forces 0 in first piece) 93 ; R=Reverse lock and user has the key (forces 0 in first piece) 94 ; 95 I '$D(^VA(200,%XQUSR,0)) Q -1 96 N %,DT 97 S DT=$$HTFM^XLFDT($H,1) 98 S %=^VA(200,%XQUSR,0) I ($P(%,U,3)="")!($L($P(%,U,11))&($P(%,U,11)'>DT)) Q -2 99 ; 100 ;Convert %XQOP to its IEN if the name is passed 101 I +%XQOP'=%XQOP D 102 .I $D(^DIC(19,"B",%XQOP))<1 S %XQOP=0 Q 103 .E S %XQOP=$O(^DIC(19,"B",%XQOP,0)) 104 .Q 105 I '%XQOP Q -3 106 I '$D(^DIC(19,%XQOP,0)) Q -3 107 ; 108 N XQCODES,XQCOM,XQDIC,XQDONE,XQI,XQJ,XQKEY,XQOK,XQPM,XQRSLT,XQSEC,XQTREE 109 S (%,XQDONE,XQOK)=0,(XQRSLT,XQCODES,XQTREE)="" 110 ; 111 ; 112 ;Look in the user's primary menu tree 113 S XQPM=$P($G(^VA(200,%XQUSR,201)),"^") 114 I 'XQPM S XQCODES=XQCODES_"N" 115 ; 116 ; 117 I XQPM S XQDIC="P"_XQPM I $D(^XUTL("XQO",XQDIC,"^",%XQOP)) D 118 .D KEYS 119 .I XQCODES'["L"&(XQCODES'["M") S XQOK=1 120 .Q 121 I XQOK Q "1^"_XQPM_"^"_XQCODES 122 I XQCODES["L"!(XQCODES["R") S XQRSLT="0^"_XQPM_"^"_XQCODES_"^"_XQKEY 123 ; 124 ; Search the common options 125 S XQCOM=$O(^DIC(19,"B","XUCOMMAND",0)) 126 S XQDIC="PXU" 127 I $D(^XUTL("XQO",XQDIC,"^",%XQOP)) D 128 .D KEYS 129 .I XQCODES'["L"&(XQCODES'["R") S XQOK=1 130 .Q 131 I XQOK Q "2^"_XQCOM_"^"_XQCODES 132 I XQRSLT="" I XQCODES["L"!(XQCODES["R") S XQRSLT="0^"_XQCOM_"^"_XQCODES_"^"_XQKEY 133 ; 134 ;Check the top level of the secondary options 135 S XQDIC="U"_%XQUSR 136 I $D(^VA(200,%XQUSR,203,0)),$P(^(0),U,4)>0 D 137 .S XQJ=0,XQDONE=0 138 .F XQI=1:1 D Q:XQDONE 139 ..S XQJ=$O(^VA(200,%XQUSR,203,XQJ)) 140 ..I (XQJ'=+XQJ)!('XQJ) S XQDONE=1 Q 141 ..S XQSEC(XQI)=+^VA(200,%XQUSR,203,XQJ,0) 142 ..Q:XQSEC(XQI)'=%XQOP 143 ..D KEYS 144 ..I XQCODES'["L"&(XQCODES'["R") S XQOK=1 145 ..I XQRSLT="" I XQCODES["L"!(XQCODES["R") S XQRSLT="0^"_XQSEC(XQI)_"^"_XQCODES_"^"_XQKEY 146 ..Q 147 .Q 148 I XQOK Q "3^"_%XQOP_"^"_XQCODES 149 ; 150 ;If there are no secondaries quit here 151 I '$D(XQI)&((XQCODES["L")!(XQCODES["R")) Q XQRSLT 152 I '$D(XQI) Q 0 153 ; 154 ;Check each secondary menu tree 155 F XQK=1:1:XQI-1 Q:XQOK D 156 .S XQDIC="P"_XQSEC(XQK) 157 .Q:'$D(^XUTL("XQO",XQDIC,"^",%XQOP)) 158 .S XQTREE=$P(XQDIC,"P",2) 159 .D KEYS 160 .I XQCODES'["L"&(XQCODES'["R") S XQOK=1 161 .I XQRSLT="" I XQCODES["L"!(XQCODES["R") S XQRSLT="0^"_XQTREE_"^"_XQCODES_"^"_XQKEY 162 .Q 163 I XQOK Q "4^"_XQTREE_"^"_XQCODES 164 I XQRSLT]"" Q XQRSLT 165 ; 166 ;We doan find nothing nowhere 167 Q "0^^"_XQCODES 168 ; 169 KEYS ;Check for keys, reverse keys... 170 N XQK,XQN,XQOPIQ,KFG 171 D CHCK1^XQCHK1 Q:KFG=1 172 I $D(^XUTL("XQO",XQDIC,"^",%XQOP)) S XQOPIQ=^(%XQOP) 173 E S XQOPIQ=U_^DIC(19,%XQOP,0) 174 ; 175 I $L($P(XQOPIQ,U,7)) D 176 .S %=$P(XQOPIQ,U,7) 177 .F XQN=1:1 S XQK=$P(%,",",XQN) Q:XQK="" D 178 ..I '$D(^XUSEC(XQK,%XQUSR)) S XQCODES=XQCODES_"L",XQKEY=XQK 179 ..Q 180 .Q 181 ; 182 I $L($P(XQOPIQ,U,17)) D 183 .S %=$P(XQOPIQ,U,17) 184 .F XQN=1:1 S XQK=$P(%,",",XQN) Q:XQK="" D 185 ..I $D(^XUSEC(XQK,%XQUSR)) S XQCODES=XQCODES_"R",XQKEY=XQK 186 ..Q 187 .Q 188 Q 71 189 ; 72 190 OPACCES ;Entry point for the option that checks to see if a user has 73 191 ;access to a particular option by calling the above function. 74 D OPACCES^XQCHK3 192 N %,DIC,X,XQANS,XQCODES,XQK,XQKEY,XQOPT,XQOPN,XQPTR,XQRSLT,XQTREE,XQUSER,XQUSN,Y 193 ; 194 S DIC(0)="AEMNQ",DIC="^VA(200,",DIC("A")="Please enter the user's name: " D ^DIC 195 I $D(DUOUT)!($D(DTOUT)) D KILLFM Q 196 I Y=-1 W !!?5,"Sorry we couldn't find that user in the New Person File.",! 197 E S XQUSN=+Y,XQUSER=$P(Y,U,2) 198 I Y=-1 D KILLFM Q 199 D KILLFM 200 ; 201 S DIC(0)="AEMNQ",DIC="^DIC(19,",DIC("A")="Please enter the name of the option: " D ^DIC 202 I $D(DUOUT)!($D(DTOUT)) D KILLFM Q 203 I Y=-1 W !!?5,"Sorry we couldn't find that option.",! 204 E S XQOPN=+Y,XQOPT=$P(Y,U,2) 205 I Y=-1 D KILLFM Q 206 D KILLFM 207 ; 208 S XQANS=$$ACCESS(XQUSN,XQOPN) 209 ;W !,XQANS,! 210 ; 211 S XQRSLT=+XQANS,XQTREE="" 212 S XQPTR=$P(XQANS,U,2) I XQPTR>0 S XQTREE=$P(^DIC(19,$P(XQANS,U,2),0),U) 213 S XQCODES=$P(XQANS,U,3),XQKEY=$P(XQANS,U,4) 214 ; 215 I XQRSLT=-1 W !!?5,"User ",XQUSER," is not in the New Person File." 216 I XQRSLT=-2 W !!?5,"User ",XQUSER," has an active termination date,",!?5,"or no verify code." 217 I XQRSLT=-3 W !!?5,"Option ",XQOPT," is not in the Option File." 218 I XQRSLT=0 D 219 .W !!?5,"User ",XQUSER," does not have access to the option",!?5,XQOPT,"." 220 .I XQCODES["L" W !!?5,"There is a lock somewhere in the menu tree "_XQTREE,!?5,"and the user does not hold the key "_XQKEY_"." 221 .I XQCODES["R" W !!?5,"There is a reverse lock somewhere in the menu tree "_XQTREE,!?5,"and the user holds the key "_XQKEY_"." 222 .Q 223 I XQRSLT=1 W !!?5,"User ",XQUSER," has access to the option ",XQOPT,!?5,"through the primary menu ",XQTREE," (",$P(^DIC(19,XQPTR,0),U,2),")." 224 I XQRSLT=2 W !!?5,"User ",XQUSER," has access to the option ",XQOPT,!?5,"through the Common Options (XUCOMMAND)." 225 I XQRSLT=3 W !!?5,"User ",XQUSER," has access to the option ",XQOPT,!?5,"as a top-level secondary menu option." 226 I XQRSLT=4 W !!?5,"User ",XQUSER," has access to the option ",XQOPT,!?5,"through the secondary menu tree ",XQTREE," (",$P(^DIC(19,XQPTR,0),U,2),")." 227 W ! 228 ;W !!,%," ",XQUSER," ",XQOPT 229 Q 230 ; 231 KILLFM ;Kill off the FileMan variables 232 K D0,DI,DIC,DIE,DISYS,DQ,DR,DUOUT,DTOUT,X,Y 75 233 Q 76 234 ;
Note:
See TracChangeset
for help on using the changeset viewer.