Fix: Add / Update user error when a role was added.
This commit is contained in:
parent
176559466a
commit
f2d617bbce
@ -102,7 +102,7 @@ def add_roles(user: User, roles: List[schemas.RoleItem], db: Session) -> None:
|
||||
ug = [g for g in user.roles if g.id == role.id_]
|
||||
ug = None if len(ug) == 0 else ug[0]
|
||||
if role.enabled and ug is None:
|
||||
user.roles.append(db.execute(select(Role).where(Role.id == role.id_)).one())
|
||||
user.roles.append(db.execute(select(Role).where(Role.id == role.id_)).scalar_one())
|
||||
elif not role.enabled and ug:
|
||||
user.roles.remove(ug)
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||
cd "$parent_path" || exit
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||
cd "$parent_path" || exit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user