mirror of https://github.com/jumpserver/jumpserver
perf: 修改BasePermissionViewSet的custom_filter_fields
parent
2db9c90a74
commit
213221beae
|
@ -14,6 +14,9 @@ class ApplicationPermissionViewSet(BasePermissionViewSet):
|
|||
serializer_class = serializers.ApplicationPermissionSerializer
|
||||
filter_fields = ['name', 'category', 'type']
|
||||
search_fields = filter_fields
|
||||
custom_filter_fields = BasePermissionViewSet.custom_filter_fields + [
|
||||
'application_id', 'application'
|
||||
]
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset().prefetch_related(
|
||||
|
|
|
@ -22,6 +22,9 @@ class AssetPermissionViewSet(BasePermissionViewSet):
|
|||
model = AssetPermission
|
||||
serializer_class = serializers.AssetPermissionSerializer
|
||||
filter_fields = ['name']
|
||||
custom_filter_fields = BasePermissionViewSet.custom_filter_fields + [
|
||||
'node_id', 'node', 'asset_id', 'hostname', 'ip'
|
||||
]
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset().prefetch_related(
|
||||
|
|
|
@ -14,6 +14,10 @@ __all__ = [
|
|||
|
||||
|
||||
class BasePermissionViewSet(OrgBulkModelViewSet):
|
||||
custom_filter_fields = [
|
||||
'user_id', 'username', 'search', 'system_user_id', 'system_user',
|
||||
'user_group_id', 'user_group'
|
||||
]
|
||||
permission_classes = (IsOrgAdmin,)
|
||||
|
||||
def filter_valid(self, queryset):
|
||||
|
|
Loading…
Reference in New Issue