add_user data into req body

This commit is contained in:
Jörn-Michael Miehe 2022-03-19 03:31:41 +00:00
parent d66ce5a026
commit 900131fae8

View file

@ -48,20 +48,17 @@ async def set_config(
},
)
async def add_user(
user_name: str,
user_password: str,
user: schemas.UserCreate,
current_config: Config | None = Depends(Config.load),
db: Session | None = Depends(Connection.get),
):
if current_config is None:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
user.capabilities.append("admin")
schemas.User.create(
db=db,
user=schemas.UserCreate(
name=user_name,
password=user_password,
capabilities=["admin"],
),
user=user,
crypt_context=await current_config.crypto.crypt_context,
)