Skip to content
Snippets Groups Projects
Verified Commit 026cc2da authored by Jan Pavlíček's avatar Jan Pavlíček
Browse files

fix: heuristic queries left outer join instead just left

parent af9d521d
No related branches found
No related tags found
1 merge request!102fix: heuristic queries left outer join instead just left
Pipeline #523328 passed
......@@ -81,6 +81,8 @@ class AuthEventLoggingQueries:
# Basic checker if MFA was performed based on upstream_acrs value
def upstream_acr_status(self, acr):
if not acr:
return None
mfa_status = next((mfa for mfa in self.MFA_CONTEXTS if mfa in acr), None)
return mfa_status is not None
......@@ -122,11 +124,18 @@ class AuthEventLoggingQueries:
.join(
requested_table,
requested_table.c.id == auth_table.c.requested_acrs_id,
isouter=True,
)
.join(
upstream_table,
upstream_table.c.id == auth_table.c.upstream_acrs_id,
isouter=True,
)
.join(
upstream_table, upstream_table.c.id == auth_table.c.upstream_acrs_id
services_table,
services_table.c.id == auth_table.c.sp_id,
isouter=True,
)
.join(services_table, services_table.c.id == auth_table.c.sp_id)
.where(auth_table.c.user_id == user_id)
.distinct(auth_table.c.ip_address)
).alias("inner_query")
......@@ -146,7 +155,6 @@ class AuthEventLoggingQueries:
)
.select_from(inner_query)
.order_by(inner_query.c.day.desc())
.limit(self.few_time_logs)
)
response = cnxn.execute(outer_query).fetchall()
......@@ -175,9 +183,12 @@ class AuthEventLoggingQueries:
.join(
agents_raw_table,
agents_raw_table.c.id == auth_table.c.user_agent_id,
isouter=True,
)
.join(
upstream_table, upstream_table.c.id == auth_table.c.upstream_acrs_id
upstream_table,
upstream_table.c.id == auth_table.c.upstream_acrs_id,
isouter=True,
)
.where(auth_table.c.user_id == user_id)
.order_by(auth_table.c.day.desc())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment