mirror of https://github.com/jumpserver/jumpserver
[Update] 修改一些bug
parent
e7031d0ac1
commit
cd7946f3f0
|
@ -1,17 +1,4 @@
|
|||
# ~*~ coding: utf-8 ~*~
|
||||
# Copyright (C) 2014-2018 Beijing DuiZhan Technology Co.,Ltd. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the GNU General Public License v2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.gnu.org/licenses/gpl-2.0.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from django.db import transaction
|
||||
from django.db.models import Count
|
||||
|
|
|
@ -30,7 +30,7 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
|
|||
(1, CUSTOM_PASSWORD)
|
||||
)
|
||||
password_strategy = serializers.ChoiceField(
|
||||
choices=PASSWORD_STRATEGY_CHOICES, required=True, initial=0,
|
||||
choices=PASSWORD_STRATEGY_CHOICES, required=False, initial=0,
|
||||
label=_('Password strategy'), write_only=True
|
||||
)
|
||||
|
||||
|
@ -62,9 +62,9 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
|
|||
|
||||
def set_role_choices(self):
|
||||
role = self.fields['role']
|
||||
choices = role.choices
|
||||
choices = role._choices
|
||||
choices.pop('App', None)
|
||||
role.choices = choices
|
||||
role._choices = choices
|
||||
|
||||
def validate_role(self, value):
|
||||
request = self.context.get('request')
|
||||
|
|
Loading…
Reference in New Issue