mirror of https://github.com/jumpserver/jumpserver
perf: 可以获取多种协议类型的系统用户列表
parent
e7a3c5a822
commit
19c2973501
|
@ -32,10 +32,15 @@ class AssetViewSet(FilterAssetByNodeMixin, OrgBulkModelViewSet):
|
|||
API endpoint that allows Asset to be viewed or edited.
|
||||
"""
|
||||
model = Asset
|
||||
filterset_fields = (
|
||||
"hostname", "ip", "systemuser__id", "admin_user__id", "platform__base",
|
||||
"is_active"
|
||||
)
|
||||
filterset_fields = {
|
||||
'hostname': ['exact'],
|
||||
'ip': ['exact'],
|
||||
'systemuser__id': ['exact'],
|
||||
'admin_user__id': ['exact'],
|
||||
'platform__base': ['exact'],
|
||||
'is_active': ['exact'],
|
||||
'protocols': ['exact', 'icontains']
|
||||
}
|
||||
search_fields = ("hostname", "ip")
|
||||
ordering_fields = ("hostname", "ip", "port", "cpu_cores")
|
||||
serializer_classes = {
|
||||
|
|
|
@ -29,7 +29,11 @@ class SystemUserViewSet(OrgBulkModelViewSet):
|
|||
System user api set, for add,delete,update,list,retrieve resource
|
||||
"""
|
||||
model = SystemUser
|
||||
filterset_fields = ("name", "username", "protocol")
|
||||
filterset_fields = {
|
||||
'name': ['exact'],
|
||||
'username': ['exact'],
|
||||
'protocol': ['exact', 'in']
|
||||
}
|
||||
search_fields = filterset_fields
|
||||
serializer_class = serializers.SystemUserSerializer
|
||||
serializer_classes = {
|
||||
|
|
|
@ -32,10 +32,7 @@ __all__ = [
|
|||
|
||||
|
||||
class UserViewSet(CommonApiMixin, UserQuerysetMixin, BulkModelViewSet):
|
||||
filterset_fields = {
|
||||
'name': ['exact', 'in']
|
||||
}
|
||||
# filterset_fields = ('username', 'email', 'name', 'id', 'source')
|
||||
filterset_fields = ('username', 'email', 'name', 'id', 'source')
|
||||
search_fields = filterset_fields
|
||||
permission_classes = (IsOrgAdmin, CanUpdateDeleteUser)
|
||||
serializer_classes = {
|
||||
|
|
Loading…
Reference in New Issue