Just remove auth tokens
This commit is contained in:
parent
536f626492
commit
18c41c2373
@ -24,7 +24,6 @@ from django.utils import timezone
|
||||
from filelock import FileLock
|
||||
from guardian.models import GroupObjectPermission
|
||||
from guardian.models import UserObjectPermission
|
||||
from rest_framework.authtoken.models import Token
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.db.models import QuerySet
|
||||
@ -285,20 +284,6 @@ class Command(CryptMixin, BaseCommand):
|
||||
serializers.serialize("json", manifest_key_to_object_query[key]),
|
||||
)
|
||||
|
||||
# Add the auth tokens to the manifest, serialized manually
|
||||
manifest_dict["auth_tokens"] = [
|
||||
{
|
||||
"model": "authtoken.token",
|
||||
"pk": t.pk,
|
||||
"fields": {
|
||||
"key": t.key,
|
||||
"user": t.user_id,
|
||||
"created": t.created.isoformat(),
|
||||
},
|
||||
}
|
||||
for t in Token.objects.all()
|
||||
]
|
||||
|
||||
self.encrypt_secret_fields(manifest_dict)
|
||||
|
||||
# These are treated specially and included in the per-document manifest
|
||||
@ -583,11 +568,7 @@ class Command(CryptMixin, BaseCommand):
|
||||
value=manifest_record["fields"][field],
|
||||
)
|
||||
|
||||
elif (
|
||||
MailAccount.objects.count() > 0
|
||||
or SocialToken.objects.count() > 0
|
||||
or Token.objects.count() > 0
|
||||
):
|
||||
elif MailAccount.objects.count() > 0 or SocialToken.objects.count() > 0:
|
||||
self.stdout.write(
|
||||
self.style.NOTICE(
|
||||
"No passphrase was given, sensitive fields will be in plaintext",
|
||||
|
@ -108,13 +108,6 @@ class CryptMixin:
|
||||
"token_secret",
|
||||
],
|
||||
},
|
||||
{
|
||||
"exporter_key": "auth_tokens",
|
||||
"model_name": "authtoken.token",
|
||||
"fields": [
|
||||
"key",
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
def get_crypt_params(self) -> dict[str, dict[str, str | int]]:
|
||||
|
@ -23,7 +23,6 @@ from django.utils import timezone
|
||||
from guardian.models import GroupObjectPermission
|
||||
from guardian.models import UserObjectPermission
|
||||
from guardian.shortcuts import assign_perm
|
||||
from rest_framework.authtoken.models import Token
|
||||
|
||||
from documents.management.commands import document_exporter
|
||||
from documents.models import Correspondent
|
||||
@ -878,8 +877,6 @@ class TestCryptExportImport(
|
||||
password="mypassword",
|
||||
)
|
||||
|
||||
Token.objects.create(user=User.objects.first())
|
||||
|
||||
app = SocialApp.objects.create(
|
||||
provider="test",
|
||||
name="test",
|
||||
@ -935,9 +932,6 @@ class TestCryptExportImport(
|
||||
self.assertIsNotNone(account)
|
||||
self.assertEqual(account.password, "mypassword")
|
||||
|
||||
token = Token.objects.first()
|
||||
self.assertIsNotNone(token)
|
||||
|
||||
social_token = SocialToken.objects.first()
|
||||
self.assertIsNotNone(social_token)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user