|
|
|
@ -3,6 +3,8 @@
|
|
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
|
from rest_framework import generics
|
|
|
|
|
from rest_framework.permissions import AllowAny
|
|
|
|
|
from rest_framework.views import APIView
|
|
|
|
|
|
|
|
|
|
from common.utils import get_logger
|
|
|
|
|
from jumpserver.conf import Config
|
|
|
|
@ -10,6 +12,7 @@ from rbac.permissions import RBACPermission
|
|
|
|
|
from .. import serializers
|
|
|
|
|
from ..models import Setting
|
|
|
|
|
from ..signals import category_setting_updated
|
|
|
|
|
from ..utils import get_interface_setting_or_default
|
|
|
|
|
|
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
|
|
|
@ -139,3 +142,19 @@ class SettingsApi(generics.RetrieveUpdateAPIView):
|
|
|
|
|
if hasattr(serializer, 'post_save'):
|
|
|
|
|
serializer.post_save()
|
|
|
|
|
self.send_signal(serializer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SettingsLogoApi(APIView):
|
|
|
|
|
permission_classes = (AllowAny,)
|
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
|
from django.views.static import serve
|
|
|
|
|
size = request.GET.get('size', 'small')
|
|
|
|
|
interface_data = get_interface_setting_or_default()
|
|
|
|
|
if size == 'small':
|
|
|
|
|
logo_path = interface_data['logo_logout']
|
|
|
|
|
else:
|
|
|
|
|
logo_path = interface_data['logo_index']
|
|
|
|
|
|
|
|
|
|
logo_path = logo_path.replace('/static/', '/')
|
|
|
|
|
return serve(request, logo_path, document_root=settings.STATIC_ROOT)
|
|
|
|
|