mirror of https://github.com/jumpserver/jumpserver
parent
30f37d9ebf
commit
71122312cf
|
@ -35,4 +35,4 @@ class ActionChoices(BitChoices):
|
|||
|
||||
@classmethod
|
||||
def display(cls, value):
|
||||
return ', '.join([c.label for c in cls if c.value & value == c.value])
|
||||
return ', '.join([str(c.label) for c in cls if c.value & value == c.value])
|
||||
|
|
|
@ -97,6 +97,10 @@ class ApplyAssetTicketViewSet(TicketViewSet):
|
|||
serializer_class = serializers.ApplyAssetSerializer
|
||||
model = ApplyAssetTicket
|
||||
filterset_class = filters.ApplyAssetTicketFilter
|
||||
serializer_classes = {
|
||||
'open': serializers.ApplyAssetSerializer,
|
||||
'approve': serializers.ApproveAssetSerializer
|
||||
}
|
||||
|
||||
|
||||
class ApplyLoginTicketViewSet(TicketViewSet):
|
||||
|
|
|
@ -9,7 +9,7 @@ from tickets.models import ApplyAssetTicket
|
|||
from .common import BaseApplyAssetSerializer
|
||||
from .ticket import TicketApplySerializer
|
||||
|
||||
__all__ = ['ApplyAssetSerializer']
|
||||
__all__ = ['ApplyAssetSerializer', 'ApproveAssetSerializer']
|
||||
|
||||
asset_or_node_help_text = _("Select at least one asset or node")
|
||||
|
||||
|
@ -57,3 +57,9 @@ class ApplyAssetSerializer(BaseApplyAssetSerializer, TicketApplySerializer):
|
|||
def setup_eager_loading(cls, queryset):
|
||||
queryset = queryset.prefetch_related('apply_nodes', 'apply_assets')
|
||||
return queryset
|
||||
|
||||
|
||||
class ApproveAssetSerializer(ApplyAssetSerializer):
|
||||
class Meta(ApplyAssetSerializer.Meta):
|
||||
read_only_fields = TicketApplySerializer.Meta.fields_small + \
|
||||
ApplyAssetSerializer.Meta.read_only_fields
|
||||
|
|
|
@ -9,8 +9,8 @@ __all__ = [
|
|||
class ApplyCommandConfirmSerializer(TicketApplySerializer):
|
||||
class Meta:
|
||||
model = ApplyCommandTicket
|
||||
fields = TicketApplySerializer.Meta.fields + [
|
||||
'apply_run_user', 'apply_run_asset', 'apply_run_account',
|
||||
'apply_run_command', 'apply_from_session', 'apply_from_cmd_filter',
|
||||
'apply_from_cmd_filter_rule'
|
||||
writeable_fields = [
|
||||
'apply_run_user', 'apply_run_asset', 'apply_run_account', 'apply_run_command',
|
||||
'apply_from_session', 'apply_from_cmd_filter', 'apply_from_cmd_filter_rule'
|
||||
]
|
||||
fields = TicketApplySerializer.Meta.fields + writeable_fields
|
||||
|
|
|
@ -9,6 +9,5 @@ __all__ = [
|
|||
class LoginAssetConfirmSerializer(TicketApplySerializer):
|
||||
class Meta:
|
||||
model = ApplyLoginAssetTicket
|
||||
fields = TicketApplySerializer.Meta.fields + [
|
||||
'apply_login_user', 'apply_login_asset', 'apply_login_account'
|
||||
]
|
||||
writeable_fields = ['apply_login_user', 'apply_login_asset', 'apply_login_account']
|
||||
fields = TicketApplySerializer.Meta.fields + writeable_fields
|
||||
|
|
|
@ -7,8 +7,7 @@ __all__ = [
|
|||
|
||||
|
||||
class LoginConfirmSerializer(TicketApplySerializer):
|
||||
class Meta:
|
||||
class Meta(TicketApplySerializer.Meta):
|
||||
model = ApplyLoginTicket
|
||||
fields = TicketApplySerializer.Meta.fields + [
|
||||
'apply_login_ip', 'apply_login_city', 'apply_login_datetime'
|
||||
]
|
||||
writeable_fields = ['apply_login_ip', 'apply_login_city', 'apply_login_datetime']
|
||||
fields = TicketApplySerializer.Meta.fields + writeable_fields
|
||||
|
|
Loading…
Reference in New Issue