mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-04-27 11:12:54 +00:00
perf: swagger api
This commit is contained in:
parent
5c61a11d82
commit
01a6019022
@ -15,7 +15,13 @@ class CustomSchemaGenerator(OpenAPISchemaGenerator):
|
||||
@staticmethod
|
||||
def exclude_some_paths(path):
|
||||
# 这里可以对 paths 进行处理
|
||||
excludes = ['/report/', '/render-to-json/', '/suggestions/', 'executions', 'automations']
|
||||
excludes = [
|
||||
'/report/', '/render-to-json/', '/suggestions/',
|
||||
'executions', 'automations', 'change-secret-records',
|
||||
'change-secret-dashboard', '/copy-to-assets/',
|
||||
'/move-to-assets/', 'dashboard',
|
||||
|
||||
]
|
||||
for p in excludes:
|
||||
if path.find(p) >= 0:
|
||||
return True
|
||||
|
@ -2,17 +2,18 @@
|
||||
#
|
||||
from functools import lru_cache
|
||||
|
||||
from rest_framework import generics
|
||||
from django.db.models import F
|
||||
from django.shortcuts import get_object_or_404
|
||||
from rest_framework import generics
|
||||
from rest_framework import mixins
|
||||
from rest_framework.viewsets import GenericViewSet
|
||||
|
||||
from orgs.mixins.api import OrgRelationMixin
|
||||
from orgs.mixins.api import OrgBulkModelViewSet
|
||||
from orgs.utils import current_org
|
||||
from perms import serializers
|
||||
from perms import models
|
||||
from perms.utils import AssetPermissionPermAssetUtil
|
||||
from accounts.serializers import AccountSerializer
|
||||
from orgs.mixins.api import OrgRelationMixin
|
||||
from orgs.utils import current_org
|
||||
from perms import models
|
||||
from perms import serializers
|
||||
from perms.utils import AssetPermissionPermAssetUtil
|
||||
|
||||
__all__ = [
|
||||
'AssetPermissionUserRelationViewSet', 'AssetPermissionUserGroupRelationViewSet',
|
||||
@ -22,8 +23,9 @@ __all__ = [
|
||||
]
|
||||
|
||||
|
||||
class RelationMixin(OrgRelationMixin, OrgBulkModelViewSet):
|
||||
class RelationMixin(OrgRelationMixin, generics.ListCreateAPIView, mixins.DestroyModelMixin, GenericViewSet):
|
||||
perm_model = models.AssetPermission
|
||||
http_method_names = ['get', 'post', 'delete']
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
|
@ -281,7 +281,7 @@ class Applet(JMSBaseModel):
|
||||
if not self.is_available_on_host(host):
|
||||
logger.debug('No available applet {} for applet host: {}'.format(self.name, host.name))
|
||||
return None
|
||||
valid_accounts = host.accounts.all().filter(is_active=True, privileged=False)
|
||||
valid_accounts = host.all_valid_accounts.all().filter(privileged=False)
|
||||
account = self.try_to_use_same_account(user, host)
|
||||
if not account:
|
||||
logger.debug('No same account, try to use private account')
|
||||
|
Loading…
Reference in New Issue
Block a user