mirror of https://github.com/jumpserver/jumpserver
commit
dd85e2d74f
|
@ -27,13 +27,10 @@ class CommandFilterACLSerializer(BaseSerializer, BulkOrgResourceModelSerializer)
|
||||||
command_groups = ObjectRelatedField(
|
command_groups = ObjectRelatedField(
|
||||||
queryset=CommandGroup.objects, many=True, required=False, label=_('Command group')
|
queryset=CommandGroup.objects, many=True, required=False, label=_('Command group')
|
||||||
)
|
)
|
||||||
command_groups_amount = serializers.IntegerField(
|
|
||||||
source='command_groups.count', read_only=True, label=_('Command group amount')
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta(BaseSerializer.Meta):
|
class Meta(BaseSerializer.Meta):
|
||||||
model = CommandFilterACL
|
model = CommandFilterACL
|
||||||
fields = BaseSerializer.Meta.fields + ['command_groups', 'command_groups_amount']
|
fields = BaseSerializer.Meta.fields + ['command_groups']
|
||||||
|
|
||||||
|
|
||||||
class CommandReviewSerializer(serializers.Serializer):
|
class CommandReviewSerializer(serializers.Serializer):
|
||||||
|
|
|
@ -686,7 +686,7 @@ msgstr "特殊信息"
|
||||||
|
|
||||||
#: accounts/serializers/account/base.py:81
|
#: accounts/serializers/account/base.py:81
|
||||||
msgid "Tip: If no username is required for authentication, fill in `null`"
|
msgid "Tip: If no username is required for authentication, fill in `null`"
|
||||||
msgstr "提示: 如果认证时不需要用户名,则填写为 null"
|
msgstr "提示: 如果认证时不需要用户名,可填写为 null"
|
||||||
|
|
||||||
#: accounts/serializers/automations/base.py:23
|
#: accounts/serializers/automations/base.py:23
|
||||||
#: assets/models/asset/common.py:155 assets/models/automations/base.py:18
|
#: assets/models/asset/common.py:155 assets/models/automations/base.py:18
|
||||||
|
|
|
@ -69,10 +69,11 @@ class NativeClient(TextChoices):
|
||||||
Protocol.rdp: [cls.mstsc],
|
Protocol.rdp: [cls.mstsc],
|
||||||
Protocol.mysql: [cls.db_client],
|
Protocol.mysql: [cls.db_client],
|
||||||
Protocol.mariadb: [cls.db_client],
|
Protocol.mariadb: [cls.db_client],
|
||||||
Protocol.oracle: [cls.db_client],
|
|
||||||
Protocol.postgresql: [cls.db_client],
|
|
||||||
Protocol.redis: [cls.db_client],
|
Protocol.redis: [cls.db_client],
|
||||||
Protocol.mongodb: [cls.db_client],
|
Protocol.mongodb: [cls.db_client],
|
||||||
|
|
||||||
|
Protocol.oracle: [cls.db_client],
|
||||||
|
Protocol.postgresql: [cls.db_client],
|
||||||
}
|
}
|
||||||
return clients
|
return clients
|
||||||
|
|
||||||
|
@ -90,12 +91,17 @@ class NativeClient(TextChoices):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def xpack_methods(cls):
|
def xpack_methods(cls):
|
||||||
return [cls.sqlplus, cls.mstsc]
|
return [cls.mstsc]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def xpack_protocols(cls):
|
||||||
|
return [Protocol.rdp, Protocol.oracle, Protocol.clickhouse, Protocol.sqlserver]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_methods(cls, os='windows'):
|
def get_methods(cls, os='windows'):
|
||||||
clients_map = cls.get_native_clients()
|
clients_map = cls.get_native_clients()
|
||||||
methods = defaultdict(list)
|
methods = defaultdict(list)
|
||||||
|
xpack_protocols = cls.xpack_protocols()
|
||||||
|
|
||||||
for protocol, _clients in clients_map.items():
|
for protocol, _clients in clients_map.items():
|
||||||
if isinstance(_clients, dict):
|
if isinstance(_clients, dict):
|
||||||
|
@ -103,6 +109,8 @@ class NativeClient(TextChoices):
|
||||||
_clients = list(itertools.chain(*_clients.values()))
|
_clients = list(itertools.chain(*_clients.values()))
|
||||||
else:
|
else:
|
||||||
_clients = _clients.get(os, _clients['default'])
|
_clients = _clients.get(os, _clients['default'])
|
||||||
|
if protocol in xpack_protocols:
|
||||||
|
continue
|
||||||
for client in _clients:
|
for client in _clients:
|
||||||
if not settings.XPACK_ENABLED and client in cls.xpack_methods():
|
if not settings.XPACK_ENABLED and client in cls.xpack_methods():
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -24,9 +24,7 @@ class UserGroupSerializer(BulkOrgResourceModelSerializer):
|
||||||
fields_small = fields_mini + [
|
fields_small = fields_mini + [
|
||||||
'comment', 'date_created', 'created_by'
|
'comment', 'date_created', 'created_by'
|
||||||
]
|
]
|
||||||
fields = fields_mini + fields_small + [
|
fields = fields_mini + fields_small + ['users']
|
||||||
'users', 'users_amount',
|
|
||||||
]
|
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
'created_by': {'label': _('Created by'), 'read_only': True},
|
'created_by': {'label': _('Created by'), 'read_only': True},
|
||||||
'users_amount': {'label': _('Users amount')},
|
'users_amount': {'label': _('Users amount')},
|
||||||
|
|
Loading…
Reference in New Issue