(
self, queryset: QuerySet[AuditLog]
)
| 68 | return Q() |
| 69 | |
| 70 | def _apply_visibility_limits( |
| 71 | self, queryset: QuerySet[AuditLog] |
| 72 | ) -> QuerySet[AuditLog]: |
| 73 | organisation = self._get_organisation() |
| 74 | if not organisation: |
| 75 | return AuditLog.objects.none() # type: ignore[no-any-return] |
| 76 | |
| 77 | subscription_metadata = organisation.subscription.get_subscription_metadata() |
| 78 | if ( |
| 79 | subscription_metadata |
| 80 | and (limit := subscription_metadata.audit_log_visibility_days) is not None |
| 81 | ): |
| 82 | queryset = queryset.filter( |
| 83 | created_date__gte=timezone.now() - timedelta(days=limit) |
| 84 | ) |
| 85 | |
| 86 | return queryset |
| 87 | |
| 88 | @abstractmethod |
| 89 | def _get_organisation(self) -> Organisation | None: |
no test coverage detected