feat: audits中添加id字段

pull/4069/head
ibuler 2020-06-02 15:41:27 +08:00
parent 087ba9ae95
commit a4ece2b271
2 changed files with 9 additions and 9 deletions

View File

@ -37,8 +37,8 @@ class UserLoginLogViewSet(ListModelMixin,
date_range_filter_fields = [ date_range_filter_fields = [
('datetime', ('date_from', 'date_to')) ('datetime', ('date_from', 'date_to'))
] ]
filterset_fields = ['username'] filter_fields = ['username', 'ip', 'city', 'type', 'status', 'mfa']
search_fields = ['ip', 'city', 'username'] search_fields =['username', 'ip', 'city']
@staticmethod @staticmethod
def get_org_members(): def get_org_members():
@ -61,8 +61,8 @@ class OperateLogViewSet(ListModelMixin, OrgGenericViewSet):
date_range_filter_fields = [ date_range_filter_fields = [
('datetime', ('date_from', 'date_to')) ('datetime', ('date_from', 'date_to'))
] ]
filterset_fields = ['user', 'action', 'resource_type'] filter_fields = ['user', 'action', 'resource_type', 'resource']
search_fields = ['filename'] search_fields = ['resource']
ordering_fields = ['-datetime'] ordering_fields = ['-datetime']

View File

@ -13,7 +13,7 @@ class FTPLogSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = models.FTPLog model = models.FTPLog
fields = ( fields = (
'user', 'remote_addr', 'asset', 'system_user', 'id', 'user', 'remote_addr', 'asset', 'system_user',
'operate', 'filename', 'is_success', 'date_start' 'operate', 'filename', 'is_success', 'date_start'
) )
@ -26,7 +26,7 @@ class UserLoginLogSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = models.UserLoginLog model = models.UserLoginLog
fields = ( fields = (
'username', 'type', 'type_display', 'ip', 'city', 'user_agent', 'id', 'username', 'type', 'type_display', 'ip', 'city', 'user_agent',
'mfa', 'reason', 'status', 'status_display', 'datetime', 'mfa_display' 'mfa', 'reason', 'status', 'status_display', 'datetime', 'mfa_display'
) )
@ -35,7 +35,7 @@ class OperateLogSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = models.OperateLog model = models.OperateLog
fields = ( fields = (
'user', 'action', 'resource_type', 'resource', 'id', 'user', 'action', 'resource_type', 'resource',
'remote_addr', 'datetime' 'remote_addr', 'datetime'
) )
@ -44,7 +44,7 @@ class PasswordChangeLogSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = models.PasswordChangeLog model = models.PasswordChangeLog
fields = ( fields = (
'user', 'change_by', 'remote_addr', 'datetime' 'id', 'user', 'change_by', 'remote_addr', 'datetime'
) )
@ -58,7 +58,7 @@ class CommandExecutionSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = CommandExecution model = CommandExecution
fields = ( fields = (
'hosts', 'run_as', 'command', 'user', 'is_finished', 'id', 'hosts', 'run_as', 'command', 'user', 'is_finished',
'date_start', 'result', 'is_success' 'date_start', 'result', 'is_success'
) )
extra_kwargs = { extra_kwargs = {