Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Aug 23, 2024
2 parents f02bf37 + a128921 commit 0a60d37
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions py/core/main/api/routes/management/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,9 @@ async def add_user_to_group_app(
)
user_uuid = UUID(user_id)
group_uuid = UUID(group_id)
result = await self.engine.aadd_user_to_group(
return await self.engine.aadd_user_to_group(
user_uuid, group_uuid
)
return {"result": result}

@self.router.post("/remove_user_from_group")
@self.base_endpoint
Expand Down
17 changes: 0 additions & 17 deletions py/core/main/api/routes/retrieval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ async def search_app(
Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.
"""
print("auth_user = ", auth_user)
print("initial vector_search_settings = ", vector_search_settings)

print(f"Received query: {query}")
print(f"Received vector_search_settings: {vector_search_settings}")
print(f"Received kg_search_settings: {kg_search_settings}")
print(f"Auth user: {auth_user}")

user_groups = set(auth_user.group_ids)
selected_groups = set(vector_search_settings.selected_group_ids)
allowed_groups = user_groups.intersection(selected_groups)
Expand All @@ -89,10 +81,6 @@ async def search_app(
"User does not have access to the specified group(s): "
f"{selected_groups - allowed_groups}"
)
print(
"initial vector_search_settings filters = ",
vector_search_settings.filters,
)

filters = {
"$or": [
Expand All @@ -105,11 +93,6 @@ async def search_app(
filters = {"$and": [filters, vector_search_settings.filters]}

vector_search_settings.filters = filters
print("final vector_search_settings = ", vector_search_settings)
print(
"final vector_search_settings filters = ",
vector_search_settings.filters,
)
results = await self.engine.asearch(
query=query,
vector_search_settings=vector_search_settings,
Expand Down
1 change: 0 additions & 1 deletion py/core/providers/database/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def get_documents_overview(
"""

results = self.execute_query(query, params).fetchall()
print("results = ", results)
documents = [
DocumentInfo(
id=row[0],
Expand Down
6 changes: 0 additions & 6 deletions py/core/providers/database/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def update_user(self, user: UserResponse) -> UserResponse:
)

def delete_user(self, user_id: UUID) -> None:
print("A")
# Get the groups the user belongs to
group_query = f"""
SELECT group_ids FROM {self._get_table_name('users')}
Expand All @@ -205,13 +204,11 @@ def delete_user(self, user_id: UUID) -> None:
group_query, {"user_id": user_id}
).fetchone()

print("B")
if not group_result:
raise R2RException(status_code=404, message="User not found")

user_groups = group_result[0]

print("C")
# Remove user from all groups they belong to
if user_groups:
group_update_query = f"""
Expand All @@ -224,7 +221,6 @@ def delete_user(self, user_id: UUID) -> None:
{"user_id": user_id, "group_ids": user_groups},
)

print("D")
# Remove user from documents
doc_update_query = f"""
UPDATE {self._get_table_name('document_info')}
Expand All @@ -233,15 +229,13 @@ def delete_user(self, user_id: UUID) -> None:
"""
self.execute_query(doc_update_query, {"user_id": user_id})

print("E")
# Delete the user
delete_query = f"""
DELETE FROM {self._get_table_name('users')}
WHERE user_id = :user_id
RETURNING user_id
"""

print("F")
result = self.execute_query(
delete_query, {"user_id": user_id}
).fetchone()
Expand Down
1 change: 0 additions & 1 deletion py/sdk/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ async def update_user(
"profile_picture": profile_picture,
}
data = {k: v for k, v in data.items() if v is not None}
print("data = ", data)
return await client._make_request("PUT", "user", json=data)

@staticmethod
Expand Down

0 comments on commit 0a60d37

Please sign in to comment.