mirror of https://github.com/jumpserver/jumpserver
fix: 修改endpoint smart API允许有效用户访问
parent
97e59384e0
commit
7b02777f1e
|
@ -98,7 +98,6 @@ MIDDLEWARE = [
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'jumpserver.urls'
|
ROOT_URLCONF = 'jumpserver.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
|
|
@ -8,6 +8,7 @@ from assets.models import Asset
|
||||||
from orgs.utils import tmp_to_root_org
|
from orgs.utils import tmp_to_root_org
|
||||||
from applications.models import Application
|
from applications.models import Application
|
||||||
from terminal.models import Session
|
from terminal.models import Session
|
||||||
|
from common.permissions import IsValidUser
|
||||||
from ..models import Endpoint, EndpointRule
|
from ..models import Endpoint, EndpointRule
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
|
|
||||||
|
@ -20,9 +21,6 @@ class EndpointViewSet(JMSBulkModelViewSet):
|
||||||
search_fields = filterset_fields
|
search_fields = filterset_fields
|
||||||
serializer_class = serializers.EndpointSerializer
|
serializer_class = serializers.EndpointSerializer
|
||||||
queryset = Endpoint.objects.all()
|
queryset = Endpoint.objects.all()
|
||||||
rbac_perms = {
|
|
||||||
'smart': 'terminal.view_endpoint'
|
|
||||||
}
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_target_ip(request):
|
def get_target_ip(request):
|
||||||
|
@ -57,7 +55,7 @@ class EndpointViewSet(JMSBulkModelViewSet):
|
||||||
target_ip = instance.get_target_ip()
|
target_ip = instance.get_target_ip()
|
||||||
return 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):
|
def smart(self, request, *args, **kwargs):
|
||||||
protocol = request.GET.get('protocol')
|
protocol = request.GET.get('protocol')
|
||||||
if not protocol:
|
if not protocol:
|
||||||
|
|
Loading…
Reference in New Issue