From 11327e746938207f8849ce275d881e61b047e198 Mon Sep 17 00:00:00 2001 From: fazledyn-or Date: Wed, 11 Oct 2023 11:50:56 +0600 Subject: [PATCH] Added the default permission in `settings.py` --- helpdesk/models.py | 4 ++-- helpdesk/settings.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/helpdesk/models.py b/helpdesk/models.py index 94e3ebcf..ec6b8b23 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1144,7 +1144,7 @@ class FollowUpAttachment(Attachment): att_path = os.path.join(settings.MEDIA_ROOT, path) if settings.DEFAULT_FILE_STORAGE == "django.core.files.storage.FileSystemStorage": if not os.path.exists(att_path): - os.makedirs(att_path, 0o755) + os.makedirs(att_path, helpdesk_settings.HELPDESK_ATTACHMENT_DIR_PERMS) return os.path.join(path, filename) @@ -1164,7 +1164,7 @@ class KBIAttachment(Attachment): att_path = os.path.join(settings.MEDIA_ROOT, path) if settings.DEFAULT_FILE_STORAGE == "django.core.files.storage.FileSystemStorage": if not os.path.exists(att_path): - os.makedirs(att_path, 0o755) + os.makedirs(att_path, helpdesk_settings.HELPDESK_ATTACHMENT_DIR_PERMS) return os.path.join(path, filename) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 7dc7ac5c..d50127a8 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -265,3 +265,11 @@ HELPDESK_OAUTH = getattr( # Set Debug Logging Level for IMAP Services. Default to '0' for No Debugging HELPDESK_IMAP_DEBUG_LEVEL = getattr(settings, 'HELPDESK_IMAP_DEBUG_LEVEL', 0) + +############################################# +# file permissions - Attachment directories # +############################################# + +# Attachment directories should be created with permission 755 (rwxr-xr-x) +# Override it in your own Django settings.py +HELPDESK_ATTACHMENT_DIR_PERMS = int(getattr(settings, 'HELPDESK_ATTACHMENT_DIR_PERMS', "755"), 8)