From ff41e8b94328afc1d1115f2869741958e0cd31e5 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:24:45 -0700 Subject: [PATCH 1/2] doc: updates about the `check` API --- docs/reference/prisma-client-ext.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/prisma-client-ext.md b/docs/reference/prisma-client-ext.md index 654c20b1..4cb01b78 100644 --- a/docs/reference/prisma-client-ext.md +++ b/docs/reference/prisma-client-ext.md @@ -20,7 +20,7 @@ The API is not supported on edge runtime (e.g., Cloudflare Workers or Vercel Edg #### Description -Checks if the current user is allowed to perform the specified operation on the model based on the access policies in ZModel. The check is done via pure logical inference and doesn't query the database. +Checks if the current user is allowed to perform the specified operation on the model based on the access policies in ZModel. The check is done via pure logical inference and doesn't query the database. It currently only deals with model-level policies and field-level ones are ignored. Please refer to [Checking Permissions Without Hitting the Database](../guides/check-permission) for more details. From 26c4f9d48dc74c5c2132de25e258c9fcfb5e54c7 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:24:57 -0700 Subject: [PATCH 2/2] update --- docs/guides/check-permission.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/check-permission.md b/docs/guides/check-permission.md index 7f86744d..f3a8dbda 100644 --- a/docs/guides/check-permission.md +++ b/docs/guides/check-permission.md @@ -194,7 +194,7 @@ You can still use the `check` API even if your access policies use these unsuppo ## Notes About Anonymous Context -Access policy rules often use `auth()` and members of `auth()` (e.g., `auth().role`) in them. When a PrismaClient is enhanced in an anonymous context (calling `enhance` without context user object), neither `auth()` nor its members are unavailable. In such cases, the following evaluation rules apply: +Access policy rules often use `auth()` and members of `auth()` (e.g., `auth().role`) in them. When a PrismaClient is enhanced in an anonymous context (calling `enhance` without context user object), neither `auth()` nor its members are available. In such cases, the following evaluation rules apply: - `auth() == null` evaluates to `true`. - `auth() != null` evaluates to `false`.