diff --git a/src-ui/src/app/services/upload-documents.service.ts b/src-ui/src/app/services/upload-documents.service.ts index 3ec93ecf6..f214a3cb5 100644 --- a/src-ui/src/app/services/upload-documents.service.ts +++ b/src-ui/src/app/services/upload-documents.service.ts @@ -28,7 +28,6 @@ export class UploadDocumentsService { fileEntry.file((file: File) => { let formData = new FormData() formData.append('document', file, file.name) - formData.set('owner', this.settings.currentUser.id.toString()) let status = this.consumerStatusService.newFileUpload(file.name) status.message = $localize`Connecting...` diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index d7feec7ef..e61c0bd97 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -683,14 +683,6 @@ class PostDocumentSerializer(serializers.Serializer): required=False, ) - owner = serializers.PrimaryKeyRelatedField( - queryset=User.objects.all(), - label="Owner", - allow_null=True, - write_only=True, - required=False, - ) - archive_serial_number = serializers.IntegerField( label="ASN", write_only=True, @@ -728,12 +720,6 @@ class PostDocumentSerializer(serializers.Serializer): else: return None - def validate_owner(self, owner): - if owner: - return owner.id - else: - return None - class BulkDownloadSerializer(DocumentListSerializer): diff --git a/src/documents/views.py b/src/documents/views.py index c14cb70e6..330f6d5c9 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -672,7 +672,6 @@ class PostDocumentView(GenericAPIView): tag_ids = serializer.validated_data.get("tags") title = serializer.validated_data.get("title") created = serializer.validated_data.get("created") - owner_id = serializer.validated_data.get("owner") archive_serial_number = serializer.validated_data.get("archive_serial_number") t = int(mktime(datetime.now().timetuple())) @@ -698,7 +697,7 @@ class PostDocumentView(GenericAPIView): override_tag_ids=tag_ids, task_id=task_id, override_created=created, - override_owner_id=owner_id, + override_owner_id=request.user.id, override_archive_serial_num=archive_serial_number, )