mirror of https://github.com/jumpserver/jumpserver
[Update] 修改public api
parent
1540cbdcaa
commit
76ef9b292b
|
@ -9,7 +9,7 @@ from rest_framework.settings import api_settings
|
|||
from rest_framework.exceptions import ValidationError
|
||||
from rest_framework.fields import SkipField, empty
|
||||
|
||||
__all__ = ['BulkSerializerMixin', 'BulkListSerializerMixin', 'CommonSerializerMixin']
|
||||
__all__ = ['BulkSerializerMixin', 'BulkListSerializerMixin', 'CommonSerializerMixin', 'CommonBulkSerializerMixin']
|
||||
|
||||
|
||||
class BulkSerializerMixin(object):
|
||||
|
@ -233,3 +233,6 @@ class EagerLoadQuerySetFields:
|
|||
class CommonSerializerMixin(DynamicFieldsMixin):
|
||||
pass
|
||||
|
||||
|
||||
class CommonBulkSerializerMixin(BulkSerializerMixin, CommonSerializerMixin):
|
||||
pass
|
||||
|
|
|
@ -437,6 +437,15 @@ class DynamicConfig:
|
|||
backends.insert(0, 'authentication.backends.radius.RadiusBackend')
|
||||
return backends
|
||||
|
||||
def XPACK_LICENSE_IS_VALID(self):
|
||||
if not HAS_XPACK:
|
||||
return False
|
||||
try:
|
||||
from xpack.plugins.license.models import License
|
||||
return bool(License.is_valid)
|
||||
except:
|
||||
return False
|
||||
|
||||
def get_from_db(self, item):
|
||||
if self.db_setting is not None:
|
||||
value = self.db_setting.get(item)
|
||||
|
|
|
@ -85,3 +85,7 @@ LOGIN_LOG_KEEP_DAYS = DYNAMIC.LOGIN_LOG_KEEP_DAYS
|
|||
TASK_LOG_KEEP_DAYS = CONFIG.TASK_LOG_KEEP_DAYS
|
||||
ORG_CHANGE_TO_URL = CONFIG.ORG_CHANGE_TO_URL
|
||||
WINDOWS_SKIP_ALL_MANUAL_PASSWORD = CONFIG.WINDOWS_SKIP_ALL_MANUAL_PASSWORD
|
||||
|
||||
# XPACK
|
||||
XPACK_LICENSE_IS_VALID = DYNAMIC.XPACK_LICENSE_IS_VALID
|
||||
|
||||
|
|
|
@ -270,6 +270,8 @@ class PublicSettingApi(generics.RetrieveAPIView):
|
|||
"data": {
|
||||
"WINDOWS_SKIP_ALL_MANUAL_PASSWORD": settings.WINDOWS_SKIP_ALL_MANUAL_PASSWORD,
|
||||
"SECURITY_MAX_IDLE_TIME": settings.SECURITY_MAX_IDLE_TIME,
|
||||
"XPACK_ENABLED": settings.XPACK_ENABLED,
|
||||
"XPACK_LICENSE_IS_VALID": settings.XPACK_LICENSE_IS_VALID
|
||||
}
|
||||
}
|
||||
return instance
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from rest_framework import serializers
|
||||
|
||||
from common.utils import validate_ssh_public_key
|
||||
from common.mixins import CommonSerializerMixin
|
||||
from common.mixins import CommonBulkSerializerMixin
|
||||
from common.serializers import AdaptedBulkListSerializer
|
||||
from common.permissions import CanUpdateDeleteUser
|
||||
from ..models import User
|
||||
|
@ -23,7 +23,7 @@ class UserOrgSerializer(serializers.Serializer):
|
|||
name = serializers.CharField()
|
||||
|
||||
|
||||
class UserSerializer(CommonSerializerMixin, serializers.ModelSerializer):
|
||||
class UserSerializer(CommonBulkSerializerMixin, serializers.ModelSerializer):
|
||||
EMAIL_SET_PASSWORD = _('Reset link will be generated and sent to the user')
|
||||
CUSTOM_PASSWORD = _('Set password')
|
||||
PASSWORD_STRATEGY_CHOICES = (
|
||||
|
@ -108,6 +108,9 @@ class UserSerializer(CommonSerializerMixin, serializers.ModelSerializer):
|
|||
return password
|
||||
|
||||
def validate_groups(self, groups):
|
||||
"""
|
||||
审计员不能加入到组中
|
||||
"""
|
||||
role = self.initial_data.get('role')
|
||||
if self.instance:
|
||||
role = role or self.instance.role
|
||||
|
|
|
@ -132,7 +132,7 @@ function initTable() {
|
|||
|
||||
$(document).ready(function(){
|
||||
usersTable = initTable();
|
||||
initCsvImportExport(usersTable, "{% trans 'User groups' %}")
|
||||
initCsvImportExport(usersTable, "{% trans 'User' %}")
|
||||
}).on('click', '#btn_bulk_update', function(){
|
||||
var action = $('#slct_bulk_update').val();
|
||||
var id_list = usersTable.selected;
|
||||
|
|
Loading…
Reference in New Issue