diff --git a/apps/assets/models/cmd_filter.py b/apps/assets/models/cmd_filter.py index dff99298c..72547da19 100644 --- a/apps/assets/models/cmd_filter.py +++ b/apps/assets/models/cmd_filter.py @@ -115,8 +115,8 @@ class CommandFilterRule(OrgModelMixin): 'apply_run_asset': session.asset, 'apply_run_system_user': session.system_user, 'apply_run_command': run_command, - 'apply_from_session': str(session.id), - 'apply_from_cmd_filter_rule': str(cmd_filter_rule.id), + 'apply_from_session_id': str(session.id), + 'apply_from_cmd_filter_rule_id': str(cmd_filter_rule.id), }, 'org_id': org_id, } diff --git a/apps/tickets/handler/command_confirm.py b/apps/tickets/handler/command_confirm.py index 33d6739e3..0e1fd0d6a 100644 --- a/apps/tickets/handler/command_confirm.py +++ b/apps/tickets/handler/command_confirm.py @@ -10,8 +10,8 @@ class Handler(BaseHandler): apply_run_asset = self.ticket.meta.get('apply_run_asset') apply_run_system_user = self.ticket.meta.get('apply_run_system_user') apply_run_command = self.ticket.meta.get('apply_run_command') - apply_from_session = self.ticket.meta.get('apply_from_session') - apply_from_cmd_filter_rule = self.ticket.meta.get('apply_from_cmd_filter_rule') + apply_from_session_id = self.ticket.meta.get('apply_from_session_id') + apply_from_cmd_filter_rule_id = self.ticket.meta.get('apply_from_cmd_filter_rule_id') applied_body = '''{}: {}, {}: {}, @@ -24,7 +24,7 @@ class Handler(BaseHandler): _("Applied run asset"), apply_run_asset, _("Applied run system user"), apply_run_system_user, _("Applied run command"), apply_run_command, - _("Applied from session"), apply_from_session, - _("Applied from command filter rules"), apply_from_cmd_filter_rule, + _("Applied from session"), apply_from_session_id, + _("Applied from command filter rules"), apply_from_cmd_filter_rule_id, ) return applied_body diff --git a/apps/tickets/serializers/ticket/meta/meta.py b/apps/tickets/serializers/ticket/meta/meta.py index ee8a402dd..12b576857 100644 --- a/apps/tickets/serializers/ticket/meta/meta.py +++ b/apps/tickets/serializers/ticket/meta/meta.py @@ -1,5 +1,7 @@ from tickets import const -from .ticket_type import apply_asset, apply_application, login_confirm, login_asset_confirm +from .ticket_type import ( + apply_asset, apply_application, login_confirm, login_asset_confirm, command_confirm +) __all__ = [ 'type_serializer_classes_mapping', @@ -35,5 +37,10 @@ type_serializer_classes_mapping = { 'default': login_asset_confirm.LoginAssetConfirmSerializer, action_open: login_asset_confirm.ApplySerializer, action_approve: login_asset_confirm.LoginAssetConfirmSerializer(read_only=True), + }, + const.TicketTypeChoices.command_confirm.value: { + 'default': command_confirm.CommandConfirmSerializer, + action_open: command_confirm.ApplySerializer, + action_approve: command_confirm.CommandConfirmSerializer(read_only=True) } } diff --git a/apps/tickets/serializers/ticket/meta/ticket_type/command_confirm.py b/apps/tickets/serializers/ticket/meta/ticket_type/command_confirm.py index 92c72f920..4dbdc08fc 100644 --- a/apps/tickets/serializers/ticket/meta/ticket_type/command_confirm.py +++ b/apps/tickets/serializers/ticket/meta/ticket_type/command_confirm.py @@ -15,8 +15,8 @@ class ApplySerializer(serializers.Serializer): required=True, max_length=64, label=_('Run system user') ) apply_run_command = serializers.CharField(required=True, label=_('Run command')) - apply_from_session = serializers.UUIDField(required=False, label=_('From session')) - apply_from_cmd_filter_rule = serializers.UUIDField( + apply_from_session_id = serializers.UUIDField(required=False, label=_('From session')) + apply_from_cmd_filter_rule_id = serializers.UUIDField( required=False, label=_('From cmd filter rule') )