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

XMXSEC.m

Go to the documentation of this file.
  1. XMXSEC ;ISC-SF/GMB-Message security and restrictions ;05/17/2002 13:25
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; All entry points covered by DBIA 2731.
  1. BCAST(XMZ) ; 0=msg was not broadcast; 1=msg was broadcast
  1. N XMBCAST
  1. S XMBCAST=$$EZBLD^DIALOG(39006) ; * (Broadcast to all local users)
  1. Q:$D(^XMB(3.9,XMZ,1,"C",$E(XMBCAST,1,30))) 1
  1. Q:$D(^XMB(3.9,XMZ,1,"C",XMBCAST)) 1
  1. Q 0
  1. ZCLOSED(XMZ) ;
  1. Q $$CLOSED($G(^XMB(3.9,XMZ,0)))
  1. CLOSED(XMZREC) ; 0=msg is not closed; 1=msg is closed
  1. Q "^Y^y^"[(U_$P(XMZREC,U,9)_U)
  1. ZCONFID(XMZ) ;
  1. Q $$CONFID($G(^XMB(3.9,XMZ,0)))
  1. CONFID(XMZREC) ; 0=msg is not confidential; 1=msg is confidential
  1. Q "^Y^y^"[(U_$P(XMZREC,U,11)_U)
  1. ZCONFIRM(XMZ) ;
  1. Q $$CONFIRM($G(^XMB(3.9,XMZ,0)))
  1. CONFIRM(XMZREC) ; 0=msg is not confirm receipt requested; 1=msg is confirm
  1. Q "^Y^y^"[(U_$P(XMZREC,U,5)_U)
  1. ZINFO(XMZ) ;
  1. Q $$INFO($G(^XMB(3.9,XMZ,0)))
  1. INFO(XMZREC) ; 0=msg is not information only; 1=msg is information only
  1. Q "^Y^y^"[(U_$P(XMZREC,U,12)_U)
  1. ZORIGIN8(XMDUZ,XMZ) ;
  1. Q $$ORIGIN8R(XMDUZ,$G(^XMB(3.9,XMZ,0)))
  1. ORIGIN8R(XMDUZ,XMZREC) ; Did the user send the message?
  1. ; 1=user is the originator ; 0=user is NOT the originator
  1. Q:XMDUZ=$P(XMZREC,U,2) 1
  1. Q:XMDUZ=$P(XMZREC,U,4) 1
  1. Q:XMDUZ=DUZ 0
  1. Q:DUZ=$P(XMZREC,U,2) 1
  1. Q:DUZ=$P(XMZREC,U,4) 1
  1. Q 0
  1. ZPRI(XMZ) ;
  1. Q $$PRIORITY($G(^XMB(3.9,XMZ,0)))
  1. PRIORITY(XMZREC) ; 0=msg is not priority; 1=msg is priority
  1. Q $P(XMZREC,U,7)["P"
  1. SURRCONF(XMDUZ,XMZ) ; 0=msg is not confidential; 1=msg is confidential, and surrogate may not read it.
  1. ; We already know that XMDUZ'=DUZ.
  1. ; But the surrogate may read a confidential message if it was the
  1. ; surrogate who sent it.
  1. Q:"^Y^y^"'[(U_$P($G(^XMB(3.9,+XMZ,0)),U,11)_U) 0
  1. Q:DUZ=$P(^(0),U,2) 0 ; naked ref from above
  1. Q:DUZ=$P(^(0),U,4) 0 ; naked ref from above
  1. Q 1
  1. ACCESS(XMDUZ,XMZ,XMZREC) ; Determines user access to a message.
  1. ; 1=user may access; 0=user may not access
  1. Q:$D(^XMB(3.7,"M",XMZ,XMDUZ)) $S(XMDUZ=DUZ:1,1:$$SURRACC(XMDUZ,"",XMZ,$G(XMZREC))) ; Message is in user's mailbox
  1. N XMPRE
  1. S XMPRE=$P(^XMB(3.7,XMDUZ,0),U,7)
  1. I XMPRE,$P($G(^XMB(3.9,XMZ,.6)),U,1)<XMPRE D Q 0
  1. . D ERRSET^XMXUTIL(37100,$$MMDT^XMXUTIL1(XMPRE),XMZ) ; You may not access any message prior to _X_ unless someone forwards it to you.
  1. Q:$D(^XMB(3.9,XMZ,1,"C",XMDUZ)) $S(XMDUZ=DUZ:1,1:$$SURRACC(XMDUZ,"",XMZ,$G(XMZREC))) ; User is recipient
  1. ;Q:$D(^XMB(3.9,XMZ,1,"C",DUZ)) 1 ; Surrogate is a recipient.
  1. ; We comment out the above line, because it's not enough that the
  1. ; surrogate is a recipient of the message. If the surrogate wants to
  1. ; access the message as XMDUZ, and the message is not in the mailbox
  1. ; of XMDUZ, then the message must have been sent by or to XMDUZ.
  1. Q:$$BCAST(XMZ) 1
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. I $P(XMZREC,U,8) D Q 0
  1. . N XMPARM
  1. . S XMPARM(1)=XMZ,XMPARM(2)=$P(XMZREC,U,8)
  1. . D ERRSET^XMXUTIL(37101,.XMPARM,XMZ) ; Message _XMZ_ is a response to message _$P(XMZREC,U,8)_.
  1. ; User (XMDUZ) is not a recipient. Investigate further.
  1. Q $$ACCESS2^XMXSEC1(XMDUZ,XMZ,XMZREC)
  1. SURRACC(XMDUZ,XMACCESS,XMZ,XMZREC) ; Determines surrogate access to a message.
  1. ; Assumes that we already know that XMDUZ is authorized to see this
  1. ; message, and that XMDUZ'=DUZ. Now we want to know if DUZ may see it.
  1. ; 1=surrogate may access; 0=surrogate may not access
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. Q:'$$CONFID(XMZREC) 1 ; Message isn't confidential.
  1. Q:DUZ=$P(XMZREC,U,2) 1 ; Surrogate sent the message.
  1. Q:DUZ=$P(XMZREC,U,4) 1 ; Surrogate sent the message.
  1. ;Q:$D(^XMB(3.9,XMZ,1,"C",DUZ)) 1 ; Surrogate is a recipient.
  1. I $G(XMACCESS)'="" D ERRSET^XMXUTIL(37452,XMACCESS,XMZ) Q 0 ; Surrogates may not _XMACCESS_ CONFIDENTIAL messages.
  1. D ERRSET^XMXUTIL(37451,XMZ) ; Surrogates may not access or do anything to Confidential messages.
  1. Q 0
  1. ANSWER(XMDUZ,XMZ,XMZREC) ; Answer (1=may, 0=may not)
  1. I DUZ=.6!(XMDUZ=.6) D ERRSET^XMXUTIL(37462,"",XMZ) Q 0 ; You may not do this in SHARED,MAIL.
  1. I XMDUZ'=DUZ Q:'$$WPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "answer"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. I $$PAKMAN^XMXSEC1(XMZ,XMZREC) D ERRSET^XMXUTIL(37401.4,"",XMZ) Q 0 ; May not answer a PackMan message.
  1. I $D(^XMB(3.9,XMZ,"K")) D ERRSET^XMXUTIL(47401.2,"",XMZ) Q 0 ; May not answer a scrambled message. Use Reply.
  1. I '$$GOTNS^XMVVITA(XMDUZ) D ERRSET^XMXUTIL($S(XMDUZ=DUZ:37401.1,1:37401.3),XMV("NAME"),XMZ) Q 0 ; You / X must have a network signature in order to answer a message.
  1. Q 1
  1. COPY(XMDUZ,XMZ,XMZREC) ; Copy (1=may, 0=may not)
  1. I XMDUZ'=DUZ Q:'$$WPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "copy"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. I $$CLOSED(XMZREC),'$$ORIGIN8R(XMDUZ,XMZREC) D ERRSET^XMXUTIL(37403.1,"",XMZ) Q 0 ; Only the message originator may copy CLOSED messages.
  1. I XMDUZ=.6,DUZ'=$P(XMZREC,U,2),DUZ'=$P(XMZREC,U,4) D ERRSET^XMXUTIL(37403.6,"",XMZ) Q 0 ; Only the originator may copy messages in SHARED,MAIL.
  1. I $D(^XMB(3.9,XMZ,"K")) D ERRSET^XMXUTIL(37403.2,"",XMZ) Q 0 ; May not copy a scrambled message.
  1. Q 1
  1. INCLUDE(XMDUZ,XMZ,XMZREC) ; Include message XMZ as part of another message (1=may, 0=may not)
  1. ; If XMDUZ'=DUZ, assumes that surrogate has the privilege to
  1. ; send a new message, or reply to a message.
  1. Q:'$$ACCESS(XMDUZ,XMZ,.XMZREC) 0
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. I $$CLOSED(XMZREC),'$$ORIGIN8R(XMDUZ,XMZREC) D ERRSET^XMXUTIL(37403.1,"",XMZ) Q 0 ; Only the message originator may copy CLOSED messages.
  1. I $D(^XMB(3.9,XMZ,"K")) D ERRSET^XMXUTIL(37403.2,"",XMZ) Q 0 ; May not copy a scrambled message.
  1. Q 1
  1. DELETE(XMDUZ,XMK,XMZ,XMZREC) ; Delete, Terminate (1=may, 0=may not)
  1. Q:XMDUZ=DUZ 1
  1. Q:'$$RWPRIV 0
  1. ;I XMDUZ=.5,$G(XMK,$O(^XMB(3.7,"M",XMZ,XMDUZ,"")))>999 Q 1
  1. I XMDUZ=.5 Q 1
  1. Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "delete"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. 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
  1. . D ERRSET^XMXUTIL(37461,"",XMZ) ; Only the originator, postmaster surrogate, or XMMGR key holder may do this in SHARED,MAIL.
  1. Q 1
  1. FORWARD(XMDUZ,XMZ,XMZREC) ; Forward (1=may, 0=may not)
  1. I XMDUZ'=DUZ Q:'$$RWPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "forward"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. I $$CLOSED(XMZREC),'$$ORIGIN8R(XMDUZ,XMZREC) D ERRSET^XMXUTIL(37406.1,"",XMZ) Q 0 ; Only the message originator may forward CLOSED messages.
  1. 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.
  1. Q 1
  1. LATER(XMDUZ) ; Later or New Toggle (1=may, 0=may not)
  1. I DUZ=.6!(XMDUZ=.6) D ERRSET^XMXUTIL(37462) Q 0 ; SHARED,MAIL may not 'later' or 'new toggle' a message.
  1. Q:XMDUZ=DUZ 1
  1. Q $$RWPRIV
  1. MOVE(XMDUZ,XMZ,XMZREC) ; Save or Filter (1=may, 0=may not)
  1. Q:XMDUZ=DUZ 1
  1. Q:'$$RWPRIV 0
  1. ;Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "save"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. 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
  1. . D ERRSET^XMXUTIL(37461,"",XMZ) ; Only the originator, postmaster surrogate, or XMMGR key holder may do this in SHARED,MAIL.
  1. Q 1
  1. READ(XMDUZ,XMZ,XMZREC) ; Read or Print (1=may, 0=may not)
  1. Q:XMDUZ=DUZ 1
  1. Q $$SURRACC(XMDUZ,"",XMZ,.XMZREC) ; "access"
  1. REPLY(XMDUZ,XMZ,XMZREC) ; Reply (1=may, 0=may not)
  1. ; Should we make sure XMZ is an original msg and not a reply?
  1. ; Should we make sure the msg has recipients?
  1. I DUZ=.6 D ERRSET^XMXUTIL(37422.6,"",XMZ) Q 0 ; May not reply to message as SHARED,MAIL.
  1. I XMDUZ'=DUZ Q:'$$RWPRIV 0 Q:'$$SURRACC(XMDUZ,"",XMZ,.XMZREC) 0 ; "reply to"
  1. I $G(XMZREC)="" S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. 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.
  1. Q:$$ORIGIN8R(XMDUZ,XMZREC) 1
  1. I $$INFO(XMZREC) D ERRSET^XMXUTIL(37422.1,"",XMZ) Q 0 ; Only originator may reply to 'INFORMATION ONLY' message.
  1. 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.
  1. 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."
  1. Q 1
  1. SEND(XMDUZ,XMINSTR) ; Send (1=may, 0=may not)
  1. I DUZ=.6!(XMDUZ=.6) D ERRSET^XMXUTIL(37462) Q 0 ; You may not do this in SHARED,MAIL.
  1. Q:XMDUZ=DUZ 1
  1. Q:$D(XMINSTR("FROM")) 1
  1. Q:XMDUZ=.5 1
  1. Q $$WPRIV
  1. RWPRIV() ; Does the surrogate have 'read' or 'send' privilege? (1=yes, 0=no)
  1. Q:$G(XMV("PRIV"))["R"!($G(XMV("PRIV"))["W") 1
  1. D ERRSET^XMXUTIL(37457,XMV("NAME")) ; You do not have 'read' or 'send' privilege for "_XMV("NAME")
  1. Q 0
  1. RPRIV() ; Does the surrogate have 'read' privilege? (1=yes, 0=no)
  1. Q:$G(XMV("PRIV"))["R" 1
  1. D ERRSET^XMXUTIL(37455,XMV("NAME")) ; You do not have 'read' privilege for "_XMV("NAME")
  1. Q 0
  1. WPRIV() ; Does the surrogate have 'send' privilege? (1=yes, 0=no)
  1. Q:$G(XMV("PRIV"))["W" 1
  1. D ERRSET^XMXUTIL(37456,XMV("NAME")) ; You do not have 'send' privilege for "_XMV("NAME")
  1. Q 0
  1. POSTPRIV() ; Perform postmaster actions (1=may, 0=may not)
  1. ; This includes permission to perform group message actions in Shared,Mail.
  1. 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.
  1. Q 1
  1. ZPOSTPRV() ; Perform postmaster actions (1=may, 0=may not)
  1. ; This includes permission to perform group message actions in Shared,Mail.
  1. Q:$D(^XUSEC("XMMGR",DUZ)) 1
  1. Q:$D(^XMB(3.7,"AB",DUZ,.5)) 1
  1. Q 0