mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-19 09:13:24 +00:00
* feat: generalize permitted_document_ids into permitted_object_ids for any model Implements Task 14 of the permission-filtering consolidation plan: - Add generic permitted_object_ids(user, model, perm, include_deleted=False) - Refactor permitted_document_ids to delegate to permitted_object_ids - Add comprehensive tests for Tag/Correspondent/DocumentType/StoragePath - Preserve exact public behavior of permitted_document_ids (100% regression-free) All 38 tests pass (18 existing + 20 new). The include_deleted parameter correctly handles soft-delete patterns (effective only for Document). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * refactor: add type hints to permitted_object_ids and permitted_document_ids Add missing type annotations to match the established conventions in this file (see get_objects_for_user_owner_aware). Also added Model import from django.db.models. - permitted_object_ids: user: User | None, model: type[Model], return -> QuerySet[int] - permitted_document_ids: user: User | None, return -> QuerySet[int] All 38 permission filtering security tests pass; this is a type-annotation-only change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UmMBGW9FKyDgmKRJ5H9rif * refactor: remove redundant deleted_at filter in permitted_object_ids SoftDeleteManager's own get_queryset() already excludes soft-deleted rows, so the extra deleted_at__isnull=True filter was dead code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>