Skip to content

Commit 1f46b8a

Browse files
committed
update upgrade guide
1 parent fb64c34 commit 1f46b8a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docs/upgrade.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,23 @@ You can switch back to the old behavior in the extension settings (VSCode only).
113113

114114
We've updated the `@zenstackhq/runtime` package to be compatible with Vercel Edge Runtime and Cloudflare Workers. See [this documentation](./guides/edge) for more details.
115115

116-
### 6. Permission Checker API 🚧
116+
### 6. Permission Checker API (Preview)
117117

118-
Coming soon. Please watch [this feature request](https://github.com/zenstackhq/zenstack/issues/242) for updates.
118+
ZenStack's access policies prevent unauthorized users to query or mutate data. However, there are cases where you simply want to check if an operation is permitted without actually executing it. For example, you might want to show or hide a button based on the user's permission.
119+
120+
The new permission checker API allows to check a user's permission without querying the database.
121+
122+
```ts
123+
const db = enhance(prisma, { user: getCurrentUser() });
124+
125+
// check if the current user can read published posts
126+
await canRead = await db.post.check({
127+
operation: 'read',
128+
where: { published: true }
129+
});
130+
```
131+
132+
Please check [this guide](./guides/check-permission) for more details.
119133

120134
## Upgrading
121135

0 commit comments

Comments
 (0)