diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index 5a8b2aa3f..4abb772ce 100644 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -28,12 +28,21 @@ from documents.models import Document from documents.models import MatchingModel from documents.models import PaperlessTask from documents.models import Tag +from documents.permissions import get_objects_for_user_owner_aware logger = logging.getLogger("paperless.handlers") def add_inbox_tags(sender, document=None, logging_group=None, **kwargs): - inbox_tags = Tag.objects.filter(is_inbox_tag=True) + if document.owner is not None: + tags = get_objects_for_user_owner_aware( + document.owner, + "documents.view_documenttype", + Tag, + ) + else: + tags = Tag.objects.all() + inbox_tags = tags.filter(is_inbox_tag=True) document.tags.add(*inbox_tags) diff --git a/src/documents/views.py b/src/documents/views.py index 1d710992b..e178fa2d5 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -194,7 +194,6 @@ class TagViewSet(ModelViewSet, PassUserMixin): ) def get_serializer_class(self, *args, **kwargs): - print(self.request.version) if int(self.request.version) == 1: return TagSerializerVersion1 else: