diff --git a/api/kiwi_vpn_api/routers/admin.py b/api/kiwi_vpn_api/routers/admin.py index 07c98a6..7f98bc9 100644 --- a/api/kiwi_vpn_api/routers/admin.py +++ b/api/kiwi_vpn_api/routers/admin.py @@ -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, )