mirror of https://github.com/jumpserver/jumpserver
fix: 修复 connection token 相关的返回字段
parent
2c952c2877
commit
37f119260e
|
@ -1,8 +1,9 @@
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from common.serializers.fields import EncryptedField
|
from perms.serializers.permission import ActionChoicesField
|
||||||
from orgs.mixins.serializers import OrgResourceModelSerializerMixin
|
from orgs.mixins.serializers import OrgResourceModelSerializerMixin
|
||||||
|
from common.serializers.fields import EncryptedField
|
||||||
from ..models import ConnectionToken
|
from ..models import ConnectionToken
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -16,6 +17,7 @@ class ConnectionTokenSerializer(OrgResourceModelSerializerMixin):
|
||||||
label=_("Input secret"), max_length=40960, required=False, allow_blank=True
|
label=_("Input secret"), max_length=40960, required=False, allow_blank=True
|
||||||
)
|
)
|
||||||
from_ticket_info = serializers.SerializerMethodField(label=_("Ticket info"))
|
from_ticket_info = serializers.SerializerMethodField(label=_("Ticket info"))
|
||||||
|
actions = ActionChoicesField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ConnectionToken
|
model = ConnectionToken
|
||||||
|
@ -29,7 +31,7 @@ class ConnectionTokenSerializer(OrgResourceModelSerializerMixin):
|
||||||
]
|
]
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
# 普通 Token 不支持指定 user
|
# 普通 Token 不支持指定 user
|
||||||
'user', 'expire_time',
|
'user', 'expire_time', 'is_expired',
|
||||||
'user_display', 'asset_display',
|
'user_display', 'asset_display',
|
||||||
]
|
]
|
||||||
fields = fields_small + read_only_fields
|
fields = fields_small + read_only_fields
|
||||||
|
|
Loading…
Reference in New Issue