|
|
@ -24,15 +24,17 @@ class UserSerializer(CommonBulkSerializerMixin, serializers.ModelSerializer):
|
|
|
|
(1, CUSTOM_PASSWORD)
|
|
|
|
(1, CUSTOM_PASSWORD)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
password_strategy = serializers.ChoiceField(
|
|
|
|
password_strategy = serializers.ChoiceField(
|
|
|
|
choices=PASSWORD_STRATEGY_CHOICES, required=False, initial=0,
|
|
|
|
choices=PASSWORD_STRATEGY_CHOICES, required=False,
|
|
|
|
label=_('Password strategy'), write_only=True
|
|
|
|
label=_('Password strategy'), write_only=True, default=0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
mfa_level_display = serializers.ReadOnlyField(source='get_mfa_level_display', label=_('MFA level for display'))
|
|
|
|
mfa_level_display = serializers.ReadOnlyField(source='get_mfa_level_display', label=_('MFA level for display'))
|
|
|
|
login_blocked = serializers.SerializerMethodField(label=_('Login blocked'))
|
|
|
|
login_blocked = serializers.SerializerMethodField(label=_('Login blocked'))
|
|
|
|
can_update = serializers.SerializerMethodField(label=_('Can update'))
|
|
|
|
can_update = serializers.SerializerMethodField(label=_('Can update'))
|
|
|
|
can_delete = serializers.SerializerMethodField(label=_('Can delete'))
|
|
|
|
can_delete = serializers.SerializerMethodField(label=_('Can delete'))
|
|
|
|
org_roles = serializers.ListField(label=_('Organization role name'), allow_null=True, required=False,
|
|
|
|
org_roles = serializers.ListField(
|
|
|
|
child=serializers.ChoiceField(choices=ORG_ROLE.choices))
|
|
|
|
label=_('Organization role name'), allow_null=True, required=False,
|
|
|
|
|
|
|
|
child=serializers.ChoiceField(choices=ORG_ROLE.choices), default=["User"]
|
|
|
|
|
|
|
|
)
|
|
|
|
key_prefix_block = "_LOGIN_BLOCK_{}"
|
|
|
|
key_prefix_block = "_LOGIN_BLOCK_{}"
|
|
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
class Meta:
|
|
|
@ -72,6 +74,7 @@ class UserSerializer(CommonBulkSerializerMixin, serializers.ModelSerializer):
|
|
|
|
'total_role_display': {'label': _('Total role name')},
|
|
|
|
'total_role_display': {'label': _('Total role name')},
|
|
|
|
'mfa_enabled': {'label': _('MFA enabled')},
|
|
|
|
'mfa_enabled': {'label': _('MFA enabled')},
|
|
|
|
'mfa_force_enabled': {'label': _('MFA force enabled')},
|
|
|
|
'mfa_force_enabled': {'label': _('MFA force enabled')},
|
|
|
|
|
|
|
|
'role': {'default': "User"},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|