add_user data into req body
This commit is contained in:
parent
d66ce5a026
commit
900131fae8
1 changed files with 4 additions and 7 deletions
|
@ -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,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue