Skip to content

Commit

Permalink
Fixes to the ACL model
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasilije1990 committed Jul 27, 2024
1 parent b4d1a73 commit 7930586
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cognee/api/v1/cognify/cognify_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cognee.infrastructure.databases.graph import get_graph_config
from cognee.infrastructure.databases.relational.user_authentication.authentication_db import async_session_maker
from cognee.infrastructure.databases.relational.user_authentication.users import has_permission_document, \
get_user_permissions, get_async_session_context
get_user_permissions, get_async_session_context, fast_api_users_init
# from cognee.infrastructure.databases.relational.user_authentication.authentication_db import async_session_maker
# from cognee.infrastructure.databases.relational.user_authentication.users import get_user_permissions, fastapi_users
from cognee.modules.cognify.config import get_cognify_config
Expand Down Expand Up @@ -40,7 +40,7 @@ def __init__(self, message: str):
self.message = message
super().__init__(self.message)

async def cognify(datasets: Union[str, list[str]] = None, root_node_id: str = None, user_id:str="default_user"):
async def cognify(datasets: Union[str, list[str]] = None, root_node_id: str = None):

relational_config = get_relationaldb_config()
db_engine = relational_config.database_engine
Expand All @@ -57,8 +57,9 @@ async def run_cognify_pipeline(dataset_name: str, files: list[dict]):
file["name"] = file["name"].replace(" ", "_")

async with get_async_session_context() as session:
active_user = await fast_api_users_init()

out = await has_permission_document(user_id, file["id"], "write", session)
out = await has_permission_document(active_user.current_user(active=True), file["id"], "write", session)


async with update_status_lock:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def get_jwt_strategy() -> JWTStrategy[models.UP, models.ID]:

fastapi_users = FastAPIUsers[User, uuid.UUID](get_user_manager, [auth_backend])

async def fast_api_users_init():
return fastapi_users

current_active_user = fastapi_users.current_user(active=True)


Expand Down

0 comments on commit 7930586

Please sign in to comment.