fix: 修改endpoint smart API允许有效用户访问

pull/8071/head
Jiangjie.Bai 3 years ago committed by Jiangjie.Bai
parent 97e59384e0
commit 7b02777f1e

@ -98,7 +98,6 @@ MIDDLEWARE = [
]
ROOT_URLCONF = 'jumpserver.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',

@ -8,6 +8,7 @@ from assets.models import Asset
from orgs.utils import tmp_to_root_org
from applications.models import Application
from terminal.models import Session
from common.permissions import IsValidUser
from ..models import Endpoint, EndpointRule
from .. import serializers
@ -20,9 +21,6 @@ class EndpointViewSet(JMSBulkModelViewSet):
search_fields = filterset_fields
serializer_class = serializers.EndpointSerializer
queryset = Endpoint.objects.all()
rbac_perms = {
'smart': 'terminal.view_endpoint'
}
@staticmethod
def get_target_ip(request):
@ -57,7 +55,7 @@ class EndpointViewSet(JMSBulkModelViewSet):
target_ip = instance.get_target_ip()
return target_ip
@action(methods=['get'], detail=False, url_path='smart')
@action(methods=['get'], detail=False, permission_classes=[IsValidUser], url_path='smart')
def smart(self, request, *args, **kwargs):
protocol = request.GET.get('protocol')
if not protocol:

Loading…
Cancel
Save