From d60498ac51d4321d21356f0a9832b6d8f176bd4e Mon Sep 17 00:00:00 2001 From: Lucian Buzzo Date: Tue, 26 Mar 2024 16:47:38 +0000 Subject: [PATCH] fix: only select role and policies that have a yates prefix --- docker-compose.yml | 2 +- src/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 542dd32..5b0e028 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,4 +34,4 @@ services: interval: 5s timeout: 5s retries: 5 - command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"] + # command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"] diff --git a/src/index.ts b/src/index.ts index 816601b..39f8d41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -403,10 +403,10 @@ export const createRoles = async < const roles = getRoles(abilities as T); const pgRoles: PgRole[] = await prisma.$queryRawUnsafe(` - select * from pg_catalog.pg_roles - `); + select * from pg_catalog.pg_roles where rolname like 'yates%' + `); const pgPolicies: PgPolicy[] = await prisma.$queryRawUnsafe(` - select * from pg_catalog.pg_policies; + select * from pg_catalog.pg_policies where policyname like 'yates%' `); // For each of the models and abilities, create a role and a corresponding RLS policy