Skip to content

Commit

Permalink
fix: remove refs to DB in check_permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
martynia committed Dec 17, 2024
1 parent 8291f0f commit 25ab41a
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ async def send_message(
) -> int:

logger.warning(f"Message received '{data}'")
user_info = await check_permissions(
action=ActionType.CREATE, pilot_db=pilot_logs_db
)
user_info = await check_permissions(action=ActionType.CREATE)
pilot_id = 0 # need to get pilot id from pilot_stamp (via PilotAgentsDB)
# also add a timestamp to be able to select and delete logs based on pilot creation dates, even if corresponding
# pilots have been already deleted from PilotAgentsDB (so the logs can live longer than pilots).
Expand Down Expand Up @@ -93,7 +91,7 @@ async def get_logs(
) -> list[dict]:

logger.warning(f"Retrieving logs for pilot ID '{pilot_id}'")
user_info = await check_permissions(action=ActionType.QUERY, pilot_db=db)
user_info = await check_permissions(action=ActionType.QUERY)

# here, users with privileged properties will see logs from all VOs. Is it what we want ?
search_params = [{"parameter": "PilotID", "operator": "eq", "value": pilot_id}]
Expand Down Expand Up @@ -122,7 +120,7 @@ async def delete(
Non-privileged users can only delete log files within their own VO.
"""
message = "no-op"
user_info = await check_permissions(action=ActionType.DELETE, pilot_db=db)
user_info = await check_permissions(action=ActionType.DELETE)
non_privil_params = {"parameter": "VO", "operator": "eq", "value": user_info.vo}

# id pilot_id is provided we ignore data.min and data.max
Expand Down

0 comments on commit 25ab41a

Please sign in to comment.