mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Exclude consumer & AnonymousUser users from export manifest
This commit is contained in:
parent
30316179a0
commit
243598ae50
@ -250,7 +250,12 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
manifest += json.loads(serializers.serialize("json", Group.objects.all()))
|
manifest += json.loads(serializers.serialize("json", Group.objects.all()))
|
||||||
|
|
||||||
manifest += json.loads(serializers.serialize("json", User.objects.all()))
|
manifest += json.loads(
|
||||||
|
serializers.serialize(
|
||||||
|
"json",
|
||||||
|
User.objects.exclude(username__in=["consumer", "AnonymousUser"]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
manifest += json.loads(
|
manifest += json.loads(
|
||||||
serializers.serialize("json", UiSettings.objects.all()),
|
serializers.serialize("json", UiSettings.objects.all()),
|
||||||
|
@ -141,7 +141,14 @@ class TestExportImport(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
|
|
||||||
manifest = self._do_export(use_filename_format=use_filename_format)
|
manifest = self._do_export(use_filename_format=use_filename_format)
|
||||||
|
|
||||||
self.assertEqual(len(manifest), 12)
|
self.assertEqual(len(manifest), 10)
|
||||||
|
|
||||||
|
# dont include consumer or AnonymousUser users
|
||||||
|
self.assertEqual(
|
||||||
|
len(list(filter(lambda e: e["model"] == "auth.user", manifest))),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
len(list(filter(lambda e: e["model"] == "documents.document", manifest))),
|
len(list(filter(lambda e: e["model"] == "documents.document", manifest))),
|
||||||
4,
|
4,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user