diff --git a/backend/btrixcloud/operator.py b/backend/btrixcloud/operator.py index 3abacf54..d41b7b93 100644 --- a/backend/btrixcloud/operator.py +++ b/backend/btrixcloud/operator.py @@ -228,6 +228,7 @@ class BtrixOperator(K8sAPI): super().__init__() self.crawl_config_ops = crawl_config_ops + self.user_ops = crawl_config_ops.user_manager self.crawl_ops = crawl_ops self.org_ops = org_ops self.coll_ops = coll_ops @@ -1261,8 +1262,9 @@ class BtrixOperator(K8sAPI): return {"attachments": []} # db create + user = await self.user_ops.get_user_by_id(uuid.UUID(userid)) await self.crawl_config_ops.add_new_crawl( - crawl_id, crawlconfig, uuid.UUID(userid), manual=False + crawl_id, crawlconfig, user, manual=False ) print("Scheduled Crawl Created: " + crawl_id) diff --git a/backend/btrixcloud/users.py b/backend/btrixcloud/users.py index 047f29ee..80458435 100644 --- a/backend/btrixcloud/users.py +++ b/backend/btrixcloud/users.py @@ -121,6 +121,10 @@ class UserManager(BaseUserManager[UserCreate, UserDB]): ) return await cursor.to_list(length=1000) + async def get_user_by_id(self, user_id: uuid.UUID): + """return user from user_id""" + return await self.user_db.get(user_id) + async def get_superuser(self): """return current superuser, if any""" return await self.user_db.collection.find_one({"is_superuser": True})