diff --git a/apps/applications/api/account.py b/apps/applications/api/account.py index 279ac926c..483836f16 100644 --- a/apps/applications/api/account.py +++ b/apps/applications/api/account.py @@ -63,6 +63,11 @@ class ApplicationAccountViewSet(JMSModelViewSet): queryset_list = unique(queryset, key=lambda x: (x['app'], x['systemuser'])) return queryset_list + @staticmethod + def filter_spm_queryset(resource_ids, queryset): + queryset = queryset.filter(uid__in=resource_ids) + return queryset + class ApplicationAccountSecretViewSet(ApplicationAccountViewSet): serializer_class = serializers.ApplicationAccountSecretSerializer diff --git a/apps/common/drf/filters.py b/apps/common/drf/filters.py index 609cb5ab0..c2fd94e3f 100644 --- a/apps/common/drf/filters.py +++ b/apps/common/drf/filters.py @@ -112,7 +112,10 @@ class IDSpmFilter(filters.BaseFilterBackend): resource_ids = cache.get(cache_key) if resource_ids is None or not isinstance(resource_ids, list): return queryset - queryset = queryset.filter(id__in=resource_ids) + if hasattr(view, 'filter_spm_queryset'): + queryset = view.filter_spm_queryset(resource_ids, queryset) + else: + queryset = queryset.filter(id__in=resource_ids) return queryset