You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/12/12 00:21:07 UTC

[incubator-ponymail-foal] 01/02: Assume email is private unless otherwise notified

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit e080f7f7a62f35c8b95e934beeb0ee52dd6099f3
Author: Sebb <se...@apache.org>
AuthorDate: Sun Dec 12 00:18:59 2021 +0000

    Assume email is private unless otherwise notified
    
    This relates to #173
---
 server/endpoints/mgmt.py | 2 +-
 server/plugins/aaa.py    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/endpoints/mgmt.py b/server/endpoints/mgmt.py
index 062347a..6ac0d67 100644
--- a/server/endpoints/mgmt.py
+++ b/server/endpoints/mgmt.py
@@ -128,7 +128,7 @@ async def process(
         new_from = indata.get("from")
         new_subject = indata.get("subject")
         new_list = indata.get("list", "")
-        private = indata.get("private", "no") == "yes"
+        private = indata.get("private", "yes") == "yes" # Assume private unless notified otherwise
         new_body = indata.get("body", "")
         attach_edit = indata.get("attachments", None)
 
diff --git a/server/plugins/aaa.py b/server/plugins/aaa.py
index 07ee695..789901c 100644
--- a/server/plugins/aaa.py
+++ b/server/plugins/aaa.py
@@ -26,7 +26,7 @@ import plugins.session
 def can_access_email(session: plugins.session.SessionObject, email) -> bool:
     """Determine if an email can be accessed by the current user"""
     # If public email, it can always be accessed
-    if not email.get("private"):
+    if not email.get("private", True): # Assume private if the flag is missing
         return True
     # If user can access the list, they can read the email
     return can_access_list(session, email.get("list_raw"))