Changed setting name to AUDIT_LOG_ENABLED
This commit is contained in:
parent
5d4e22220d
commit
3732666bcf
@ -1138,7 +1138,7 @@ combination with PAPERLESS_CONSUMER_BARCODE_UPSCALE bigger than 1.0.
|
|||||||
|
|
||||||
## Audit Trail
|
## Audit Trail
|
||||||
|
|
||||||
#### [`PAPERLESS_AUDIT_ENABLED=<bool>`](#PAPERLESS_AUDIT_ENABLED){#PAPERLESS_AUDIT_ENABLED}
|
#### [`PAPERLESS_AUDIT_LOG_ENABLED=<bool>`](#PAPERLESS_AUDIT_LOG_ENABLED){#PAPERLESS_AUDIT_LOG_ENABLED}
|
||||||
|
|
||||||
: Enables an audit trail for each document,document type, correspondent, and tag. This records all changes made to the documents to make the changes traceable.
|
: Enables an audit trail for each document,document type, correspondent, and tag. This records all changes made to the documents to make the changes traceable.
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from documents.models import ShareLink
|
|||||||
from documents.models import StoragePath
|
from documents.models import StoragePath
|
||||||
from documents.models import Tag
|
from documents.models import Tag
|
||||||
|
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
from auditlog.admin import LogEntryAdmin
|
from auditlog.admin import LogEntryAdmin
|
||||||
from auditlog.models import LogEntry
|
from auditlog.models import LogEntry
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ admin.site.register(PaperlessTask, TaskAdmin)
|
|||||||
admin.site.register(Note, NotesAdmin)
|
admin.site.register(Note, NotesAdmin)
|
||||||
admin.site.register(ShareLink, ShareLinksAdmin)
|
admin.site.register(ShareLink, ShareLinksAdmin)
|
||||||
|
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
|
|
||||||
class LogEntryAUDIT(LogEntryAdmin):
|
class LogEntryAUDIT(LogEntryAdmin):
|
||||||
def has_delete_permission(self, request, obj=None):
|
def has_delete_permission(self, request, obj=None):
|
||||||
|
@ -20,7 +20,7 @@ from django.utils import timezone
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from multiselectfield import MultiSelectField
|
from multiselectfield import MultiSelectField
|
||||||
|
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
from auditlog.registry import auditlog
|
from auditlog.registry import auditlog
|
||||||
|
|
||||||
from documents.data_models import DocumentSource
|
from documents.data_models import DocumentSource
|
||||||
@ -877,7 +877,7 @@ class ConsumptionTemplate(models.Model):
|
|||||||
return f"{self.name}"
|
return f"{self.name}"
|
||||||
|
|
||||||
|
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
auditlog.register(Document, m2m_fields={"tags"})
|
auditlog.register(Document, m2m_fields={"tags"})
|
||||||
auditlog.register(Correspondent)
|
auditlog.register(Correspondent)
|
||||||
auditlog.register(Tag)
|
auditlog.register(Tag)
|
||||||
|
@ -115,7 +115,7 @@ from paperless import version
|
|||||||
from paperless.db import GnuPG
|
from paperless.db import GnuPG
|
||||||
from paperless.views import StandardPagination
|
from paperless.views import StandardPagination
|
||||||
|
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
from auditlog.models import LogEntry
|
from auditlog.models import LogEntry
|
||||||
|
|
||||||
logger = logging.getLogger("paperless.api")
|
logger = logging.getLogger("paperless.api")
|
||||||
@ -526,7 +526,7 @@ class DocumentViewSet(
|
|||||||
c.save()
|
c.save()
|
||||||
# If audit log is enabled make an entry in the log
|
# If audit log is enabled make an entry in the log
|
||||||
# about this note change
|
# about this note change
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
timezone.now()
|
timezone.now()
|
||||||
LogEntry.objects.log_create(
|
LogEntry.objects.log_create(
|
||||||
instance=doc,
|
instance=doc,
|
||||||
@ -562,7 +562,7 @@ class DocumentViewSet(
|
|||||||
return HttpResponseForbidden("Insufficient permissions to delete")
|
return HttpResponseForbidden("Insufficient permissions to delete")
|
||||||
|
|
||||||
note = Note.objects.get(id=int(request.GET.get("id")))
|
note = Note.objects.get(id=int(request.GET.get("id")))
|
||||||
if settings.AUDIT_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
timezone.now()
|
timezone.now()
|
||||||
LogEntry.objects.log_create(
|
LogEntry.objects.log_create(
|
||||||
instance=doc,
|
instance=doc,
|
||||||
|
@ -936,17 +936,17 @@ TIKA_GOTENBERG_ENDPOINT = os.getenv(
|
|||||||
if TIKA_ENABLED:
|
if TIKA_ENABLED:
|
||||||
INSTALLED_APPS.append("paperless_tika.apps.PaperlessTikaConfig")
|
INSTALLED_APPS.append("paperless_tika.apps.PaperlessTikaConfig")
|
||||||
|
|
||||||
AUDIT_ENABLED = __get_boolean("PAPERLESS_AUDIT_ENABLED", "NO")
|
AUDIT_LOG_ENABLED = __get_boolean("PAPERLESS_AUDIT_LOG_ENABLED", "NO")
|
||||||
if AUDIT_ENABLED:
|
if AUDIT_LOG_ENABLED:
|
||||||
INSTALLED_APPS.append("auditlog")
|
INSTALLED_APPS.append("auditlog")
|
||||||
MIDDLEWARE.append("auditlog.middleware.AuditlogMiddleware")
|
MIDDLEWARE.append("auditlog.middleware.AuditlogMiddleware")
|
||||||
db_conn = connections["default"]
|
db_conn = connections["default"]
|
||||||
|
|
||||||
all_tables = db_conn.introspection.table_names()
|
all_tables = db_conn.introspection.table_names()
|
||||||
|
|
||||||
if ("auditlog_logentry" in all_tables) and not (AUDIT_ENABLED):
|
if ("auditlog_logentry" in all_tables) and not (AUDIT_LOG_ENABLED):
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
"auditlog table was found but PAPERLESS_AUDIT_ENABLED is not active.",
|
"auditlog table was found but PAPERLESS_AUDIT_LOG_ENABLED is not active.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user