Skip to content

Commit 487dae2

Browse files
committed
updates
1 parent 48e1806 commit 487dae2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

blog/better-auth/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ model TodoList {
503503
504504
#### 6. A user as full access to `Todo` if he can read its parent `TodoList`
505505
506-
A model can use its relations to define access rules. The `check()` helper allows you to directly delegate permission check to a relation.
506+
We've managed to protect the `TodoList` model, and rules for the `Todo` model are yet to be defined. Fortunately, ZenStack allows you to reference relations in policy rules. The `check()` helper allows you to directly delegate permission check to a relation (here `Todo` -> `TodoList`).
507507
508508
```zmodel title="/schema.zmodel"
509509
model Todo {
@@ -524,6 +524,8 @@ With the CRUD APIs secured and frontend hooks generated, implementing the UI for
524524
525525
```tsx title="/app/dashboard/todo-lists-card.tsx"
526526
export default function TodoListsCard() {
527+
// Note that you don't need to filter for the current user and the active organization
528+
// because the ZModel rules have taken care of it
527529
const { data: todoLists } = useFindManyTodoList({
528530
orderBy: { createdAt: 'desc' },
529531
});

0 commit comments

Comments
 (0)