async def create_user(request: Request) -> HTTPResponse: rjs = request.json user_service = UserService(request[REQUEST_DB_SESSION_KEY]) team = rjs.get("team") or config.team_name user_service.create_user( username=rjs["username"], raw_password=rjs["password"], team=team, roles=rjs["roles"], ) return response.json(rjs, 201)
def _create_system_user(session: Session) -> None: user_service = UserService(session) if user_service.fetch_user(rasa_x_config.SYSTEM_USER): logger.debug( f"Found existing system system user '{rasa_x_config.SYSTEM_USER}'." ) return user_service.create_user( rasa_x_config.SYSTEM_USER, None, rasa_x_config.team_name, ADMIN ) logger.debug(f"Created new system user '{rasa_x_config.SYSTEM_USER}'.")