XMXSEC ;ISC-SF/GMB-Message security and restrictions ;05/17/2002 13:25 ;;8.0;MailMan;;Jun 28, 2002 ; All entry points covered by DBIA 2731. BCAST(XMZ) ; 0=msg was not broadcast; 1=msg was broadcast N XMBCAST S XMBCAST=$$EZBLD^DIALOG(39006) ; * (Broadcast to all local users) Q:$D(^XMB(3.9,XMZ,1,"C",$E(XMBCAST,1,30))) 1 Q:$D(^XMB(3.9,XMZ,1,"C",XMBCAST)) 1 Q 0 ZCLOSED(XMZ) ; Q $$CLOSED($G(^XMB(3.9,XMZ,0))) CLOSED(XMZREC) ; 0=msg is not closed; 1=msg is closed Q "^Y^y^"[(U_$P(XMZREC,U,9)_U) ZCONFID(XMZ) ; Q $$CONFID($G(^XMB(3.9,XMZ,0))) CONFID(XMZREC) ; 0=msg is not confidential; 1=msg is confidential Q "^Y^y^"[(U_$P(XMZREC,U,11)_U) ZCONFIRM(XMZ) ; Q $$CONFIRM($G(^XMB(3.9,XMZ,0))) CONFIRM(XMZREC) ; 0=msg is not confirm receipt requested; 1=msg is confirm Q "^Y^y^"[(U_$P(XMZREC,U,5)_U) ZINFO(XMZ) ; Q $$INFO($G(^XMB(3.9,XMZ,0))) INFO(XMZREC) ; 0=msg is not information only; 1=msg is information only Q "^Y^y^"[(U_$P(XMZREC,U,12)_U) ZORIGIN8(XMDUZ,XMZ) ; Q $$ORIGIN8R(XMDUZ,$G(^XMB(3.9,XMZ,0))) ORIGIN8R(XMDUZ,XMZREC) ; Did the user send the message? ; 1=user is the originator ; 0=user is NOT the originator Q:XMDUZ=$P(XMZREC,U,2) 1 Q:XMDUZ=$P(XMZREC,U,4) 1 Q:XMDUZ=DUZ 0 Q:DUZ=$P(XMZREC,U,2) 1 Q:DUZ=$P(XMZREC,U,4) 1 Q 0 ZPRI(XMZ) ; Q $$PRIORITY($G(^XMB(3.9,XMZ,0))) PRIORITY(XMZREC) ; 0=msg is not priority; 1=msg is priority Q $P(XMZREC,U,7)["P" SURRCONF(XMDUZ,XMZ) ; 0=msg is not confidential; 1=msg is confidential, and surrogate may not read it. ; We already know that XMDUZ'=DUZ. ; But the surrogate may read a confidential message if it was the ; surrogate who sent it. Q:"^Y^y^"'[(U_$P($G(^XMB(3.9,+XMZ,0)),U,11)_U) 0 Q:DUZ=$P(^(0),U,2) 0 ; naked ref from above Q:DUZ=$P(^(0),U,4) 0 ; naked ref from above Q 1 ACCESS(XMDUZ,XMZ,XMZREC) ; Determines user access to a message. ; 1=user may access; 0=user may not access Q:$D(^XMB(3.7,"M",XMZ,XMDUZ)) $S(XMDUZ=DUZ:1,1:$$SURRACC(XMDUZ,"",XMZ,$G(XMZREC))) ; Message is in user's mailbox N XMPRE S XMPRE=$P(^XMB(3.7,XMDUZ,0),U,7) I XMPRE,$P($G(^XMB(3.9,XMZ,.6)),U,1)999 Q 1 I XMDUZ=.5 Q 1 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "delete" I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0)) I XMDUZ=.6,DUZ'=$P(XMZREC,U,2),DUZ'=$P(XMZREC,U,4),'$D(^XUSEC("XMMGR",DUZ)),'$D(^XMB(3.7,"AB",DUZ,.5,0)) D Q 0 . D ERRSET^XMXUTIL(37461,"",XMZ) ; Only the originator, postmaster surrogate, or XMMGR key holder may do this in SHARED,MAIL. Q 1 FORWARD(XMDUZ,XMZ,XMZREC) ; Forward (1=may, 0=may not) I XMDUZ'=DUZ Q:'$$RWPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "forward" I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0)) I $$CLOSED(XMZREC),'$$ORIGIN8R(XMDUZ,XMZREC) D ERRSET^XMXUTIL(37406.1,"",XMZ) Q 0 ; Only the message originator may forward CLOSED messages. I XMDUZ=.6,DUZ'=$P(XMZREC,U,2),DUZ'=$P(XMZREC,U,4) D ERRSET^XMXUTIL(37406.6,"",XMZ) Q 0 ; Only the originator may forward messages in SHARED,MAIL. Q 1 LATER(XMDUZ) ; Later or New Toggle (1=may, 0=may not) I DUZ=.6!(XMDUZ=.6) D ERRSET^XMXUTIL(37462) Q 0 ; SHARED,MAIL may not 'later' or 'new toggle' a message. Q:XMDUZ=DUZ 1 Q $$RWPRIV MOVE(XMDUZ,XMZ,XMZREC) ; Save or Filter (1=may, 0=may not) Q:XMDUZ=DUZ 1 Q:'$$RWPRIV 0 ;Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "save" I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0)) I XMDUZ=.6,DUZ'=$P(XMZREC,U,2),DUZ'=$P(XMZREC,U,4),'$D(^XUSEC("XMMGR",DUZ)),'$D(^XMB(3.7,"AB",DUZ,.5,0)) D Q 0 . D ERRSET^XMXUTIL(37461,"",XMZ) ; Only the originator, postmaster surrogate, or XMMGR key holder may do this in SHARED,MAIL. Q 1 READ(XMDUZ,XMZ,XMZREC) ; Read or Print (1=may, 0=may not) Q:XMDUZ=DUZ 1 Q $$SURRACC(XMDUZ,"",XMZ,.XMZREC) ; "access" REPLY(XMDUZ,XMZ,XMZREC) ; Reply (1=may, 0=may not) ; Should we make sure XMZ is an original msg and not a reply? ; Should we make sure the msg has recipients? I DUZ=.6 D ERRSET^XMXUTIL(37422.6,"",XMZ) Q 0 ; May not reply to message as SHARED,MAIL. I XMDUZ'=DUZ Q:'$$RWPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "reply to" I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0)) I $D(^XMB(3.9,XMZ,"K")),$$PAKMAN^XMXSEC1(XMZ,XMZREC) D ERRSET^XMXUTIL(37422.4,"",XMZ) Q 0 ; May not reply to secure PackMan message. Q:$$ORIGIN8R(XMDUZ,XMZREC) 1 I $$INFO(XMZREC) D ERRSET^XMXUTIL(37422.1,"",XMZ) Q 0 ; Only originator may reply to 'INFORMATION ONLY' message. I $P($G(^XMB(3.9,XMZ,1,+$O(^XMB(3.9,XMZ,1,"C",XMDUZ,0)),"T")),U,1)["I" D ERRSET^XMXUTIL(37422.2,"",XMZ) Q 0 ; 'INFORMATION ONLY' recipient may not reply to message. I $P(XMZREC,U,2)["POSTMASTER@" D ERRSET^XMXUTIL(37422.5,"",XMZ) Q 0 ; You may not reply to a message from a remote Postmaster." Q 1 SEND(XMDUZ,XMINSTR) ; Send (1=may, 0=may not) I DUZ=.6!(XMDUZ=.6) D ERRSET^XMXUTIL(37462) Q 0 ; You may not do this in SHARED,MAIL. Q:XMDUZ=DUZ 1 Q:$D(XMINSTR("FROM")) 1 Q:XMDUZ=.5 1 Q $$WPRIV RWPRIV() ; Does the surrogate have 'read' or 'send' privilege? (1=yes, 0=no) Q:$G(XMV("PRIV"))["R"!($G(XMV("PRIV"))["W") 1 D ERRSET^XMXUTIL(37457,XMV("NAME")) ; You do not have 'read' or 'send' privilege for "_XMV("NAME") Q 0 RPRIV() ; Does the surrogate have 'read' privilege? (1=yes, 0=no) Q:$G(XMV("PRIV"))["R" 1 D ERRSET^XMXUTIL(37455,XMV("NAME")) ; You do not have 'read' privilege for "_XMV("NAME") Q 0 WPRIV() ; Does the surrogate have 'send' privilege? (1=yes, 0=no) Q:$G(XMV("PRIV"))["W" 1 D ERRSET^XMXUTIL(37456,XMV("NAME")) ; You do not have 'send' privilege for "_XMV("NAME") Q 0 POSTPRIV() ; Perform postmaster actions (1=may, 0=may not) ; This includes permission to perform group message actions in Shared,Mail. I '$D(^XUSEC("XMMGR",DUZ)),'$D(^XMB(3.7,"AB",DUZ,.5)) D ERRSET^XMXUTIL(37458) Q 0 ; Only a POSTMASTER surrogate or XMMGR key holder may do this. Q 1 ZPOSTPRV() ; Perform postmaster actions (1=may, 0=may not) ; This includes permission to perform group message actions in Shared,Mail. Q:$D(^XUSEC("XMMGR",DUZ)) 1 Q:$D(^XMB(3.7,"AB",DUZ,.5)) 1 Q 0