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

XMXSEC2.m

Go to the documentation of this file.
  1. XMXSEC2 ;ISC-SF/GMB - Message security and restrictions (cont.) ;04/18/2002 08:01
  1. ;;8.0;MailMan;**47**;Jun 28, 2002;Build 6
  1. ; All entry points covered by DBIA 2733.
  1. EDIT(XMDUZ,XMZ,XMZREC) ; May the user edit the message? (1=may, 0=may not)
  1. I '$$ORIGIN8R^XMXSEC(XMDUZ,.XMZREC) D ERRSET^XMXUTIL(37405.1) Q 0 ; Only the originator may Edit a message.
  1. I $P($G(^XMB(3.9,XMZ,1,0)),U,4)>1!($P(XMZREC,U,2)'=$O(^XMB(3.9,XMZ,1,"C",0))) D ERRSET^XMXUTIL(37405.2) Q 0 ; You may not Edit a message you have already sent to someone else.
  1. I $O(^XMB(3.9,XMZ,3,0)) D ERRSET^XMXUTIL(37405.3) Q 0 ; You may not Edit a message which has a reply.
  1. I $D(^XMB(3.9,XMZ,"K")),XMINSTR("TYPE")["X"!(XMINSTR("TYPE")["K") D ERRSET^XMXUTIL(37405.4) ; You may not Edit a secure KIDS or PackMan message.
  1. Q 1
  1. OPTEDIT(XMINSTR,XMOPT,XMOX,XMQDNUM) ; We know the user may edit the message.
  1. ; Now, what, exactly, may be edited?
  1. D SET("C",$S($G(XMINSTR("FLAGS"))["C":37302,1:37301),.XMOPT,.XMOX) ; UnConfidential (surrogate may read) / Confidential (surrogate can't read)
  1. D SET("D",$S($D(XMINSTR("RCPT BSKT")):37304,1:37303),.XMOPT,.XMOX) ; Delivery basket remove / Delivery basket set
  1. D SET("I",$S($G(XMINSTR("FLAGS"))["I":37308,1:37307),.XMOPT,.XMOX) ; UnInformation only / Information only
  1. D SET("NS",37309,.XMOPT,.XMOX) ; Add Network Signature
  1. D SET("P",$S($G(XMINSTR("FLAGS"))["P":37312,1:37311),.XMOPT,.XMOX) ; Normal delivery / Priority delivery
  1. D SET("R",$S($G(XMINSTR("FLAGS"))["R":37314,1:37313),.XMOPT,.XMOX) ; No Confirm receipt / Confirm receipt
  1. D SET("ES",37305,.XMOPT,.XMOX) ; Edit Subject
  1. D SET("ET",37306,.XMOPT,.XMOX) ; Edit Text
  1. D SET("V",$S($G(XMINSTR("VAPOR")):37318,1:37317),.XMOPT,.XMOX) ; Vaporize date remove / Vaporize date set
  1. D SET("X",$S($G(XMINSTR("FLAGS"))["X":37320,1:37319),.XMOPT,.XMOX) ; UnClose (forward allowed) / Closed (no forward allowed)
  1. D SET("S",$S($D(^XMB(3.9,XMZ,"K")):37316,$D(XMINSTR("SCR KEY")):37316,1:37315),.XMOPT,.XMOX) ; UnScramble / Scramble message text
  1. I $G(XMPAKMAN)!($G(XMINSTR("TYPE"))["X")!($G(XMINSTR("TYPE"))["K") D
  1. . D Q("NX",37309.4) ; You may not add a Network Signature to a KIDS or PackMan message.
  1. . D Q("S",37315.4) ; Sorry, but we can't (un)secure a KIDS or PackMan message here.
  1. I '$D(XMOPT("NS","?")),'$$GOTNS^XMVVITA(XMDUZ) D
  1. . ; pgmr note: this must be the last place that sets XMOPT("NS","?").
  1. . I XMDUZ=DUZ D Q("NS",37309.1) Q ; You have no Network Signature.
  1. . S XMOPT("NS","?")=$$EZBLD^DIALOG(37309.3,XMV("NAME")) ; |1| has no Network Signature.
  1. I $D(^TMP("XMY",$J,.6)) D
  1. . D Q("C",37301.6) ; Messages addressed to SHARED,MAIL may not be 'Confidential'.
  1. . D Q("X",37320.6) ; Messages addressed to SHARED,MAIL may not be 'Closed'.
  1. ; **XM*8*47 Adds conditionals to check if the subject line and message portion can be edited similar to OPTMSG.**
  1. N XMFROM,XMFLAG
  1. S XMFROM=$P(^XMB(3.9,XMZ,0),U,2),XMFLAG=0
  1. I $P($G(^XMB(3.9,XMZ,1,0)),U,4)>1!(XMFROM'=$O(^XMB(3.9,XMZ,1,"C",0))) S XMFLAG=1 D Q("ES",37405.2),Q("ET",37405.2)
  1. I $O(^XMB(3.9,XMZ,3,0)),'XMFLAG D Q("ES",37405.3),Q("ET",37405.3)
  1. Q
  1. SET(XMCD,XMDN,XMOPT,XMOX) ;
  1. N XMDREC
  1. S XMDREC=$$EZBLD^DIALOG(XMDN)
  1. S XMOPT(XMCD)=$P(XMDREC,":",2,99)
  1. S XMOX("O",XMCD)=$P(XMDREC,":",1) ; "O"=original english to foreign
  1. S XMOX("X",$P(XMDREC,":",1))=XMCD ; "X"=translate foreign to english
  1. Q
  1. Q(XMCD,XMDN) ;
  1. I $G(XMQDNUM) S XMOPT(XMCD,"?")=XMDN Q
  1. S XMOPT(XMCD,"?")=$$EZBLD^DIALOG(XMDN)
  1. Q
  1. OPTMSG(XMDUZ,XMK,XMZ,XMIM,XMINSTR,XMIU,XMOPT,XMOX,XMQDNUM) ; The user has access to the message. Now what may the user do with it?
  1. ; in:
  1. ; XMDUZ = the user
  1. ; XMK = basket IEN if message is in a basket
  1. ; = ! if super search (option XM SUPER SEARCH)
  1. ; = 0 otherwise
  1. ; XMZ = the message IEN
  1. ; The following are set by INMSG1 and INMSG2^XMXUTIL2
  1. ; XMIM("FROM") = piece 2 of the message's zero node
  1. ; XMINSTR = special instructions
  1. ; XMIU("ORIGN8")=
  1. ; XMIU("IEN") = the user's IEN in the message's recipient multiple
  1. ; XMQDNUM = 0 - set XMOPT(<opt>,"?")=dialog text (default)
  1. ; 1 - set XMOPT(<opt>,"?")=dialog number (all are TYPE: ERROR)
  1. ; FYI, XMOPT(<opt>,"?") is displayed in SHOWERR^XMJDIR.
  1. ; out:
  1. ; XMOPT(<opt>) Possible options
  1. ; '$D(XMOPT(<opt>,"?")) User may do these things.
  1. ; $D(XMOPT(<opt>,"?")) User may NOT do these things.
  1. N XMSECPAK
  1. I $D(^XMB(3.9,XMZ,"K")),XMINSTR("TYPE")["X"!(XMINSTR("TYPE")["K") S XMSECPAK=1 ; secure packman
  1. E S XMSECPAK=0
  1. K XMOPT,XMOX
  1. D SET("B",37441,.XMOPT,.XMOX) ; Backup
  1. D SET("I",37442,.XMOPT,.XMOX) ; Ignore
  1. D SET("P",37416,.XMOPT,.XMOX) ; Print
  1. D SET("Q",37417,.XMOPT,.XMOX) ; Query
  1. D SET("QC",37431,.XMOPT,.XMOX) ; Query Current
  1. D SET("QD",37418,.XMOPT,.XMOX) ; Query Detailed
  1. D SET("QN",37419,.XMOPT,.XMOX) ; Query Network
  1. D SET("QNC",37432,.XMOPT,.XMOX) ; Query Not Current
  1. D SET("QR",37420,.XMOPT,.XMOX) ; Query Recipients
  1. D SET("QT",37433,.XMOPT,.XMOX) ; Query Terminated
  1. Q:XMK="!"
  1. D SET("A",37401,.XMOPT,.XMOX) ; Answer
  1. D SET("AA",37402,.XMOPT,.XMOX) ; Access Attachments
  1. D SET("C",37403,.XMOPT,.XMOX) ; Copy
  1. D SET("D",37404,.XMOPT,.XMOX) ; Delete
  1. D SET("E",37405,.XMOPT,.XMOX) ; Edit
  1. D SET("F",37406,.XMOPT,.XMOX) ; Forward
  1. D SET("IN",$S($G(XMINSTR("FLAGS"))["I":37409,1:37408),.XMOPT,.XMOX) ; UnInformation only / Information only
  1. D SET("H",37407,.XMOPT,.XMOX) ; Headerless Print
  1. D SET("K",$S($G(XMINSTR("FLAGS"))["K":37412,1:37411),.XMOPT,.XMOX) ; UnPriority replies / Priority replies
  1. D SET("L",37413,.XMOPT,.XMOX) ; Later
  1. D SET("N",$S($G(XMINSTR("FLAGS"))["N":37415,1:37414),.XMOPT,.XMOX) ; UnNew / New
  1. D SET("R",37422,.XMOPT,.XMOX) ; Reply
  1. D SET("S",37423,.XMOPT,.XMOX) ; Save
  1. D SET("T",37424,.XMOPT,.XMOX) ; Terminate
  1. D SET("V",37425,.XMOPT,.XMOX) ; Vaporize date edit
  1. D SET("W",37444,.XMOPT,.XMOX) ; Write
  1. D SET("X",$S($G(XMINSTR("TYPE"))["K":37427,$G(XMINSTR("TYPE"))["X":37428,1:37426),.XMOPT,.XMOX) ; Xtract KIDS / Xtract PackMan / Xtract
  1. I XMDUZ=DUZ!($G(XMV("PRIV"))["W") D
  1. . D OPTW(XMDUZ,XMZ,XMIM("FROM"),XMIU("ORIGN8"),XMSECPAK,.XMINSTR)
  1. E D
  1. . D OPTWNO^XMXSEC3(XMIU("ORIGN8"))
  1. D OPTR(XMDUZ,XMK,XMZ,.XMIU,XMSECPAK,.XMINSTR)
  1. I DUZ=.6 D Q("R",37422.6) ; SHARED,MAIL may not Reply to a message.
  1. I XMDUZ=.6 D DOSHARE^XMXSEC3(XMDUZ,XMK,XMIU("ORIGN8"),.XMINSTR) Q
  1. I XMDUZ=.5,XMK>999 D DOPOST^XMXSEC3
  1. Q
  1. OPTW(XMDUZ,XMZ,XMFROM,XMORIGN8,XMSECPAK,XMINSTR) ; User must be self or have 'write' privilege as surrogate.
  1. I XMINSTR("TYPE")["X"!(XMINSTR("TYPE")["K") D Q("A",37401.4) ; You may not Answer a KIDS or PackMan message.
  1. I XMINSTR("FLAGS")["X",'XMORIGN8 D Q("C",37403.1) ; Only the originator may Copy a 'closed' message.
  1. I $D(^XMB(3.9,XMZ,"K")) D
  1. . I XMSECPAK D Q("C",37403.4) ; You may not Copy a secure KIDS or PackMan message.
  1. . E D
  1. . . I '$D(XMOPT("A","?")) D Q("A",37401.2) ; You may not Answer a scrambled message. Use Reply.
  1. . . I '$D(XMOPT("C","?")) D Q("C",37403.2) ; You may not Copy a scrambled message.
  1. I '$D(XMOPT("A","?")),'$$GOTNS^XMVVITA(XMDUZ) D
  1. . ; pgmr note: this must be the last place that sets XMOPT("A","?").
  1. . I XMDUZ=DUZ D Q("A",37401.1) Q ; You must have a Network Signature to Answer a message.
  1. . S XMOPT("A","?")=$$EZBLD^DIALOG(37401.3,XMV("NAME")) ; |1| must have a Network Signature to Answer a message.
  1. I 'XMORIGN8 D Q
  1. . D Q("IN",37409.1) ; Only the originator may toggle 'Information only'.
  1. . D Q("E",37405.1) ; Only the originator may Edit a message.
  1. I $P($G(^XMB(3.9,XMZ,1,0)),U,4)>1!(XMFROM'=$O(^XMB(3.9,XMZ,1,"C",0))) D Q
  1. . ; You may not Edit a message you have already sent to someone else.
  1. . ; You may toggle the 'information only' switch, if you wish.
  1. . I $G(XMQDNUM) S XMOPT("E","?")=37405.2 Q
  1. . N DIR
  1. . D BLD^DIALOG(37405.2,"","","DIR(""?"")")
  1. . M XMOPT("E","?")=DIR("?")
  1. I $O(^XMB(3.9,XMZ,3,0)) D Q("E",37405.3) Q ; You may not Edit a message which has a reply.
  1. I XMSECPAK D Q("E",37405.4) ; You may not Edit a secure KIDS or PackMan message.
  1. Q
  1. OPTR(XMDUZ,XMK,XMZ,XMIU,XMSECPAK,XMINSTR) ; User must be self or have 'read' privilege as surrogate.
  1. I '$O(^XMB(3.9,XMZ,2005,0)) D Q("AA",37402.1) ; This message has no Attachments.
  1. I 'XMK D
  1. . D Q("D",37404.1) ; This message has already been deleted. It's not in a basket.
  1. . D Q("V",37425.1) ; This message has already vaporized. It's not in a basket.
  1. I XMINSTR("FLAGS")'["P" D Q("K",37412.1) ; The message must be 'priority' in order to toggle 'Priority replies'.
  1. I XMINSTR("FLAGS")["X",'XMIU("ORIGN8") D Q("F",37406.1) ; Only the originator may forward a 'closed' message.
  1. I XMSECPAK D
  1. . D Q("P",37416.4) ; You may not Print a secure KIDS or PackMan message.
  1. . S XMOPT("H","?")=XMOPT("P","?")
  1. . D Q("R",37422.4) ; You may not Reply to a secure KIDS or PackMan message.
  1. E I 'XMIU("ORIGN8") D
  1. . I XMINSTR("FLAGS")["I" D Q("R",37422.1) Q ; Only the originator may Reply to an 'Information only' message.
  1. . I $P($G(^XMB(3.9,XMZ,1,XMIU("IEN"),"T")),U,1)="I" D Q("R",37422.2) ; 'Information only' recipients may not reply to a message.
  1. E I $$BCAST^XMXSEC(XMZ) D Q("R",37422.3) ; May not reply to a Broadcast message. Send a new one.
  1. I XMINSTR("TYPE")["X"!(XMINSTR("TYPE")["K") D
  1. . I '$D(^XUSEC("XUPROGMODE",DUZ)) D Q("X",37428.2) ; You must hold the XUPROGMODE key to extract KIDS or PackMan messages.
  1. E D Q("X",37428.1) ; This message is neither KIDS nor PackMan.
  1. Q