From a3da8ca01fd0577742042382447f791231502ee4 Mon Sep 17 00:00:00 2001 From: Danzel Artamadja Date: Thu, 8 May 2025 12:16:40 +0700 Subject: [PATCH] update use non deprecated createPermissionRule Signed-off-by: Danzel Artamadja --- .../03-adding-a-resource-permission-check.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/permissions/plugin-authors/03-adding-a-resource-permission-check.md b/docs/permissions/plugin-authors/03-adding-a-resource-permission-check.md index e3f23ba17f..afa56307ce 100644 --- a/docs/permissions/plugin-authors/03-adding-a-resource-permission-check.md +++ b/docs/permissions/plugin-authors/03-adding-a-resource-permission-check.md @@ -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'), }),