mirror of https://github.com/jumpserver/jumpserver
parent
db050e405d
commit
20cc8a124f
|
@ -219,7 +219,6 @@ class Application(CommonModelMixin, OrgModelMixin, ApplicationTreeNodeMixin):
|
||||||
verbose_name = _('Application')
|
verbose_name = _('Application')
|
||||||
unique_together = [('org_id', 'name')]
|
unique_together = [('org_id', 'name')]
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
verbose_name = _("Application")
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
category_display = self.get_category_display()
|
category_display = self.get_category_display()
|
||||||
|
|
|
@ -261,6 +261,7 @@ class SecretDetailMixin:
|
||||||
'asset': asset,
|
'asset': asset,
|
||||||
'application': application,
|
'application': application,
|
||||||
'gateway': gateway,
|
'gateway': gateway,
|
||||||
|
'domain': domain,
|
||||||
'remote_app': remote_app,
|
'remote_app': remote_app,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +274,7 @@ class SecretDetailMixin:
|
||||||
return {
|
return {
|
||||||
'asset': asset,
|
'asset': asset,
|
||||||
'application': None,
|
'application': None,
|
||||||
|
'domain': asset.domain,
|
||||||
'gateway': gateway,
|
'gateway': gateway,
|
||||||
'remote_app': None,
|
'remote_app': None,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ from rest_framework import serializers
|
||||||
|
|
||||||
from common.utils import get_object_or_none
|
from common.utils import get_object_or_none
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from assets.models import Asset, SystemUser, Gateway
|
from assets.models import Asset, SystemUser, Gateway, Domain
|
||||||
from applications.models import Application
|
from applications.models import Application
|
||||||
from users.serializers import UserProfileSerializer
|
from users.serializers import UserProfileSerializer
|
||||||
from assets.serializers import ProtocolsField
|
from assets.serializers import ProtocolsField
|
||||||
|
@ -169,7 +169,7 @@ class ConnectionTokenAssetSerializer(serializers.ModelSerializer):
|
||||||
class ConnectionTokenSystemUserSerializer(serializers.ModelSerializer):
|
class ConnectionTokenSystemUserSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SystemUser
|
model = SystemUser
|
||||||
fields = ['id', 'name', 'username', 'password', 'private_key', 'ad_domain']
|
fields = ['id', 'name', 'username', 'password', 'private_key', 'ad_domain', 'org_id']
|
||||||
|
|
||||||
|
|
||||||
class ConnectionTokenGatewaySerializer(serializers.ModelSerializer):
|
class ConnectionTokenGatewaySerializer(serializers.ModelSerializer):
|
||||||
|
@ -185,9 +185,19 @@ class ConnectionTokenRemoteAppSerializer(serializers.Serializer):
|
||||||
|
|
||||||
|
|
||||||
class ConnectionTokenApplicationSerializer(serializers.ModelSerializer):
|
class ConnectionTokenApplicationSerializer(serializers.ModelSerializer):
|
||||||
|
attrs = serializers.JSONField(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Application
|
model = Application
|
||||||
fields = ['id', 'name', 'category', 'type']
|
fields = ['id', 'name', 'category', 'type', 'attrs', 'org_id']
|
||||||
|
|
||||||
|
|
||||||
|
class ConnectionTokenDomainSerializer(serializers.ModelSerializer):
|
||||||
|
gateways = ConnectionTokenGatewaySerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Domain
|
||||||
|
fields = ['id', 'name', 'gateways']
|
||||||
|
|
||||||
|
|
||||||
class ConnectionTokenSecretSerializer(serializers.Serializer):
|
class ConnectionTokenSecretSerializer(serializers.Serializer):
|
||||||
|
@ -199,6 +209,7 @@ class ConnectionTokenSecretSerializer(serializers.Serializer):
|
||||||
remote_app = ConnectionTokenRemoteAppSerializer(read_only=True)
|
remote_app = ConnectionTokenRemoteAppSerializer(read_only=True)
|
||||||
application = ConnectionTokenApplicationSerializer(read_only=True)
|
application = ConnectionTokenApplicationSerializer(read_only=True)
|
||||||
system_user = ConnectionTokenSystemUserSerializer(read_only=True)
|
system_user = ConnectionTokenSystemUserSerializer(read_only=True)
|
||||||
|
domain = ConnectionTokenDomainSerializer(read_only=True)
|
||||||
gateway = ConnectionTokenGatewaySerializer(read_only=True)
|
gateway = ConnectionTokenGatewaySerializer(read_only=True)
|
||||||
actions = ActionsField()
|
actions = ActionsField()
|
||||||
expired_at = serializers.IntegerField()
|
expired_at = serializers.IntegerField()
|
||||||
|
|
Loading…
Reference in New Issue