Change: enable auditlog by default, fix import / export (#6267)

This commit is contained in:
shamoon
2024-04-04 11:51:15 -07:00
committed by GitHub
parent a13bd2a2dd
commit c875770731
7 changed files with 47 additions and 16 deletions

View File

@@ -5,7 +5,6 @@ import shutil
import stat
from django.conf import settings
from django.core.checks import Critical
from django.core.checks import Error
from django.core.checks import Warning
from django.core.checks import register
@@ -205,13 +204,10 @@ def audit_log_check(app_configs, **kwargs):
all_tables = db_conn.introspection.table_names()
result = []
if ("auditlog_logentry" in all_tables) and not (settings.AUDIT_LOG_ENABLED):
if ("auditlog_logentry" in all_tables) and not settings.AUDIT_LOG_ENABLED:
result.append(
Critical(
(
"auditlog table was found but PAPERLESS_AUDIT_LOG_ENABLED"
" is not active. This setting cannot be disabled after enabling"
),
Warning(
("auditlog table was found but audit log is disabled."),
),
)

View File

@@ -1045,7 +1045,7 @@ TIKA_GOTENBERG_ENDPOINT = os.getenv(
if TIKA_ENABLED:
INSTALLED_APPS.append("paperless_tika.apps.PaperlessTikaConfig")
AUDIT_LOG_ENABLED = __get_boolean("PAPERLESS_AUDIT_LOG_ENABLED", "NO")
AUDIT_LOG_ENABLED = __get_boolean("PAPERLESS_AUDIT_LOG_ENABLED", "true")
if AUDIT_LOG_ENABLED:
INSTALLED_APPS.append("auditlog")
MIDDLEWARE.append("auditlog.middleware.AuditlogMiddleware")

View File

@@ -259,9 +259,6 @@ class TestAuditLogChecks(TestCase):
msg = msgs[0]
self.assertIn(
(
"auditlog table was found but PAPERLESS_AUDIT_LOG_ENABLED"
" is not active."
),
("auditlog table was found but audit log is disabled."),
msg.msg,
)