Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update policy creation interface #22

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion rls/alembic_rls.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def check_rls_policies(conn, schemaname, tablename):
AND tablename = '{tablename}';"""
)
).fetchall()
return result
# Convert to a list of dictionaries
columns = ["policyname", "permissive", "roles", "qual", "with_check"]
result_dicts = [dict(zip(columns, row)) for row in result]

return result_dicts


def check_table_exists(conn, schemaname, tablename) -> bool:
Expand Down Expand Up @@ -171,6 +175,10 @@ def compare_table_level(
policy_meta.get_sql_policies(table_name=tablename, name_suffix=str(idx))
policy_expr = policy_meta.expression
for ix, single_policy_name in enumerate(policy_meta.policy_names):
print("****************************************")
print("rls_policies_db: ", rls_policies_db)
print("****************************************")

matched_policy = next(
(p for p in rls_policies_db if p["policyname"] == single_policy_name),
None,
Expand Down
Loading
Loading