From eaeddf3ec37f82a5f9a9201a8e354be524f440f5 Mon Sep 17 00:00:00 2001 From: Omer Zuarets Date: Fri, 6 Dec 2024 14:47:40 +0200 Subject: [PATCH 1/2] fix factdb role assignments pagination and filters --- horizon/local/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/horizon/local/api.py b/horizon/local/api.py index 6fadd26a..e5b49fad 100644 --- a/horizon/local/api.py +++ b/horizon/local/api.py @@ -170,7 +170,12 @@ async def legacy_list_role_assignments() -> list[RoleAssignment]: ) return await legacy_list_role_assignments() else: - res = await policy_store.list_facts_by_type("role_assignments") + res = await policy_store.list_facts_by_type( + "role_assignments", + page=page, + per_page=per_page, + filters=filters, + ) res_json = parse_obj_as( list[RoleAssignmentFactDBFact], await res.json() ) From a5600ac2cef44f3bf30dba691f09a9142439b04f Mon Sep 17 00:00:00 2001 From: Omer Zuarets Date: Mon, 9 Dec 2024 15:02:01 +0200 Subject: [PATCH 2/2] fix debug always not sent to underlying factdb --- horizon/enforcer/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/horizon/enforcer/api.py b/horizon/enforcer/api.py index e75425c7..dbc21ff5 100644 --- a/horizon/enforcer/api.py +++ b/horizon/enforcer/api.py @@ -317,9 +317,10 @@ async def _is_allowed_factdb( ): headers = transform_headers(request) url = f"{sidecar_config.FACTDB_SERVICE_URL}/v1/authz{path}" - payload = None if query is None else {"input": jsonable_encoder(query)} + _encoded_query = jsonable_encoder(query) + payload = None if query is None else {"input": _encoded_query} exc = None - if query is not None and isinstance(query, dict): + if _encoded_query is not None and isinstance(_encoded_query, dict): _set_use_debugger(payload) try: logger.info(