update use non deprecated createPermissionRule
Signed-off-by: Danzel Artamadja <notwatermango@gmail.com>
This commit is contained in:
@@ -125,7 +125,10 @@ $ yarn workspace @internal/plugin-todo-list-backend add zod
|
||||
Create a new `plugins/todo-list-backend/src/service/rules.ts` file and append the following code:
|
||||
|
||||
```typescript title="plugins/todo-list-backend/src/service/rules.ts"
|
||||
import { createPermissionResourceRef } from '@backstage/plugin-permission-node';
|
||||
import {
|
||||
createPermissionResourceRef,
|
||||
createPermissionRule,
|
||||
} from '@backstage/plugin-permission-node';
|
||||
import { TODO_LIST_RESOURCE_TYPE } from '@internal/plugin-todo-list-common';
|
||||
import { z } from 'zod';
|
||||
import { Todo, TodoFilter } from './todos';
|
||||
@@ -141,7 +144,7 @@ export const todoListPermissionResourceRef = createPermissionResourceRef<
|
||||
export const isOwner = createPermissionRule({
|
||||
name: 'IS_OWNER',
|
||||
description: 'Should allow only if the todo belongs to the user',
|
||||
resourceType: todoListPermissionResourceRef,
|
||||
resourceRef: todoListPermissionResourceRef,
|
||||
paramsSchema: z.object({
|
||||
userId: z.string().describe('User ID to match on the resource'),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user