mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-15 16:42:34 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
622bef07ad | ||
|
|
a23bd4b3eb | ||
|
|
9bd9d443b4 |
@@ -301,7 +301,7 @@ class Asset(AbsConnectivity, AbsHardwareInfo, ProtocolsMixin, NodesRelationMixin
|
||||
'private_key': auth_user.private_key_file
|
||||
}
|
||||
|
||||
if not with_become:
|
||||
if not with_become or self.is_windows():
|
||||
return info
|
||||
|
||||
if become_user:
|
||||
|
||||
@@ -8,6 +8,7 @@ from ..filters import RoleFilter
|
||||
from ..serializers import RoleSerializer, RoleUserSerializer
|
||||
from ..models import Role, SystemRole, OrgRole
|
||||
from .permission import PermissionViewSet
|
||||
from common.mixins.api import PaginatedResponseMixin
|
||||
|
||||
__all__ = [
|
||||
'RoleViewSet', 'SystemRoleViewSet', 'OrgRoleViewSet',
|
||||
@@ -15,7 +16,7 @@ __all__ = [
|
||||
]
|
||||
|
||||
|
||||
class RoleViewSet(JMSModelViewSet):
|
||||
class RoleViewSet(PaginatedResponseMixin, JMSModelViewSet):
|
||||
queryset = Role.objects.all()
|
||||
serializer_classes = {
|
||||
'default': RoleSerializer,
|
||||
@@ -54,7 +55,7 @@ class RoleViewSet(JMSModelViewSet):
|
||||
def users(self, *args, **kwargs):
|
||||
role = self.get_object()
|
||||
queryset = role.users
|
||||
return self.get_paginated_response_with_query_set(queryset)
|
||||
return self.get_paginated_response_from_queryset(queryset)
|
||||
|
||||
|
||||
class SystemRoleViewSet(RoleViewSet):
|
||||
|
||||
@@ -89,16 +89,20 @@ class CommandStorage(CommonStorageModelMixin, CommonModelMixin):
|
||||
return Terminal.objects.filter(command_storage=self.name, is_deleted=False).exists()
|
||||
|
||||
def get_command_queryset(self):
|
||||
if self.type_null:
|
||||
return Command.objects.none()
|
||||
|
||||
if self.type_server:
|
||||
qs = Command.objects.all()
|
||||
else:
|
||||
if self.type not in TYPE_ENGINE_MAPPING:
|
||||
logger.error(f'Command storage `{self.type}` not support')
|
||||
return Command.objects.none()
|
||||
return Command.objects.all()
|
||||
|
||||
if self.type in TYPE_ENGINE_MAPPING:
|
||||
engine_mod = import_module(TYPE_ENGINE_MAPPING[self.type])
|
||||
qs = engine_mod.QuerySet(self.config)
|
||||
qs.model = Command
|
||||
return qs
|
||||
return qs
|
||||
|
||||
logger.error(f'Command storage `{self.type}` not support')
|
||||
return Command.objects.none()
|
||||
|
||||
def save(self, force_insert=False, force_update=False, using=None,
|
||||
update_fields=None):
|
||||
|
||||
Reference in New Issue
Block a user