perf: 资产编号允许api更改

pull/7004/head
ibuler 3 years ago committed by Jiangjie.Bai
parent 6e0341b7b1
commit 42e7ca6a18

@ -91,7 +91,7 @@ class SystemUserAssetAuthInfoApi(generics.RetrieveAPIView):
asset_id = self.kwargs.get('asset_id') asset_id = self.kwargs.get('asset_id')
user_id = self.request.query_params.get("user_id") user_id = self.request.query_params.get("user_id")
username = self.request.query_params.get("username") username = self.request.query_params.get("username")
instance.load_asset_more_auth(asset_id=asset_id, user_id=user_id, username=username) instance.load_asset_more_auth(asset_id, user_id, username)
return instance return instance
@ -107,8 +107,7 @@ class SystemUserAppAuthInfoApi(generics.RetrieveAPIView):
instance = super().get_object() instance = super().get_object()
app_id = self.kwargs.get('app_id') app_id = self.kwargs.get('app_id')
user_id = self.request.query_params.get("user_id") user_id = self.request.query_params.get("user_id")
if user_id: instance.load_app_more_auth(app_id, user_id)
instance.load_app_more_auth(app_id, user_id)
return instance return instance

@ -74,11 +74,11 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
model = Asset model = Asset
fields_mini = ['id', 'hostname', 'ip', 'platform', 'protocols'] fields_mini = ['id', 'hostname', 'ip', 'platform', 'protocols']
fields_small = fields_mini + [ fields_small = fields_mini + [
'protocol', 'port', 'protocols', 'is_active', 'public_ip', 'protocol', 'port', 'protocols', 'is_active',
'comment', 'public_ip', 'number', 'comment',
] ]
hardware_fields = [ hardware_fields = [
'number', 'vendor', 'model', 'sn', 'cpu_model', 'cpu_count', 'vendor', 'model', 'sn', 'cpu_model', 'cpu_count',
'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total', 'disk_info', 'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total', 'disk_info',
'os', 'os_version', 'os_arch', 'hostname_raw', 'hardware_info', 'os', 'os_version', 'os_arch', 'hostname_raw', 'hardware_info',
'connectivity', 'date_verified' 'connectivity', 'date_verified'

Loading…
Cancel
Save