Skip to content

Commit

Permalink
Merge pull request #31 from vnsamsonov/fix/grant-access-for-readonly
Browse files Browse the repository at this point in the history
Change condition for checking user grants
  • Loading branch information
vnsamsonov authored Oct 19, 2023
2 parents 685c472 + ec99fee commit 90edb55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions k8s-itlabs-operator/clients/postgres/postgresclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ def is_user_grantee(self, database: str, user: str) -> bool:
UNION
SELECT 1
FROM pg_default_acl acl
join pg_namespace namespace on namespace.oid = acl.defaclnamespace
WHERE acl.defaclacl::text ILIKE %s;
JOIN pg_namespace namespace on namespace.oid = acl.defaclnamespace
WHERE acl.defaclacl::text ILIKE %s
AND acl.defaclacl::text ILIKE %s;
"""
return bool(self._execute_query_v2(
query,
values=[user, database, f"%{user}=r/{database}%"],
values=[user, database, f"%{user}%", f"%{database}%"],
))

def is_database_exist(self, db_name: str) -> bool:
Expand Down

0 comments on commit 90edb55

Please sign in to comment.