Fixed admins cannot assign users to admins #88

This commit is contained in:
Sven Heidemann 2022-11-10 20:26:29 +01:00
parent b30d49f5d7
commit 3c1f017e3a
3 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import enum
from inspect import signature, Parameter from inspect import signature, Parameter
from cpl_core.utils import String from cpl_core.utils import String
@ -28,6 +29,9 @@ class JSONProcessor:
if isinstance(value, dict): if isinstance(value, dict):
value = JSONProcessor.process(parameter.annotation, value) value = JSONProcessor.process(parameter.annotation, value)
if issubclass(parameter.annotation, enum.Enum):
value = parameter.annotation(value)
args.append(value) args.append(value)
elif parameter.default != Parameter.empty: elif parameter.default != Parameter.empty:

View File

@ -85,7 +85,7 @@ class AuthUserDTO(DtoABC):
self._email = values['email'] self._email = values['email']
self._password = values['password'] self._password = values['password']
self._is_confirmed = values['isConfirmed'] self._is_confirmed = values['isConfirmed']
self._auth_role = values['authRole'] self._auth_role = AuthRoleEnum(values['authRole'])
def to_dict(self) -> dict: def to_dict(self) -> dict:
return { return {

View File

@ -33,8 +33,8 @@ class UpdateAuthUserDTO(DtoABC):
return self._change_password return self._change_password
def from_dict(self, values: dict): def from_dict(self, values: dict):
self._auth_user = values['authUser'] self._auth_user = AuthUserDTO().from_dict(values['authUser'])
self._new_auth_user = values['newAuthUser'] self._new_auth_user = AuthUserDTO().from_dict(values['newAuthUser'])
self._change_password = False if 'changePassword' not in values else bool(values['changePassword']) self._change_password = False if 'changePassword' not in values else bool(values['changePassword'])
def to_dict(self) -> dict: def to_dict(self) -> dict: