diff --git a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts index 9ea67ec0b2..5662b27d48 100644 --- a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts +++ b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts @@ -28,11 +28,13 @@ export const createPropertyRule = (propertyType: 'metadata' | 'spec') => description: `Allow entities which have the specified ${propertyType} subfield.`, resourceType: RESOURCE_TYPE_CATALOG_ENTITY, schema: z.object({ - key: z.string().describe(`The key of the ${propertyType} to match on`), + key: z + .string() + .describe(`Property within the entities ${propertyType} to match on`), value: z .string() .optional() - .describe(`Optional value of the ${propertyType} to match on`), + .describe(`Value of the given property to match on`), }), apply: (resource, { key, value }) => { const foundValue = get(resource[propertyType], key); diff --git a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts index 28c99e39a1..0d80977c09 100644 --- a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts +++ b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts @@ -35,11 +35,11 @@ export const hasAnnotation = createCatalogPermissionRule<{ 'Allow entities which are annotated with the specified annotation', resourceType: RESOURCE_TYPE_CATALOG_ENTITY, schema: z.object({ - annotation: z.string().describe('The name of the annotation to match on'), + annotation: z.string().describe('Name of the annotation to match on'), value: z .string() .optional() - .describe('Optional value of the annotation to match on'), + .describe('Value of the annotation to match on'), }), apply: (resource, { annotation, value }) => !!resource.metadata.annotations?.hasOwnProperty(annotation) && diff --git a/plugins/catalog-backend/src/permissions/rules/hasLabel.ts b/plugins/catalog-backend/src/permissions/rules/hasLabel.ts index fbad7e42d0..6b7b9d9da0 100644 --- a/plugins/catalog-backend/src/permissions/rules/hasLabel.ts +++ b/plugins/catalog-backend/src/permissions/rules/hasLabel.ts @@ -28,7 +28,7 @@ export const hasLabel = createCatalogPermissionRule({ description: 'Allow entities which have the specified label metadata.', resourceType: RESOURCE_TYPE_CATALOG_ENTITY, schema: z.object({ - label: z.string().describe('Name of the label'), + label: z.string().describe('Name of the label to match one'), }), apply: (resource, { label }) => !!resource.metadata.labels?.hasOwnProperty(label), diff --git a/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts b/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts index 8c16f4c5a1..d64b357d9f 100644 --- a/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts +++ b/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts @@ -28,7 +28,9 @@ export const isEntityKind = createCatalogPermissionRule({ description: 'Allow entities with the specified kind', resourceType: RESOURCE_TYPE_CATALOG_ENTITY, schema: z.object({ - kinds: z.array(z.string()), + kinds: z + .array(z.string()) + .describe('List of kinds to match at least one of'), }), apply(resource, { kinds }) { const resourceKind = resource.kind.toLocaleLowerCase('en-US'); diff --git a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts index 27431f09a7..824e5e9ca6 100644 --- a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts +++ b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts @@ -30,7 +30,11 @@ export const isEntityOwner = createCatalogPermissionRule({ description: 'Allow entities owned by the current user', resourceType: RESOURCE_TYPE_CATALOG_ENTITY, schema: z.object({ - claims: z.array(z.string()), + claims: z + .array(z.string()) + .describe( + `List of claims to match at least one on within ${RELATION_OWNED_BY}`, + ), }), apply: (resource, { claims }) => { if (!resource.relations) { diff --git a/plugins/permission-node/src/types.ts b/plugins/permission-node/src/types.ts index 521c8ac3ad..e69c1f3d78 100644 --- a/plugins/permission-node/src/types.ts +++ b/plugins/permission-node/src/types.ts @@ -61,7 +61,7 @@ export type PermissionRule< // with an optional zod type. [P in keyof TParams]-?: TParams[P] extends undefined ? z.ZodOptionalType> - : z.ZodType; + : z.ZodType; }>; /** diff --git a/plugins/playlist-backend/src/permissions/rules.ts b/plugins/playlist-backend/src/permissions/rules.ts index 897d2e19eb..79214b050d 100644 --- a/plugins/playlist-backend/src/permissions/rules.ts +++ b/plugins/playlist-backend/src/permissions/rules.ts @@ -36,7 +36,7 @@ const isOwner = createPlaylistPermissionRule<{ description: 'Should allow only if the playlist belongs to the user', resourceType: PLAYLIST_LIST_RESOURCE_TYPE, schema: z.object({ - owners: z.array(z.string().describe('List of owner entity refs')), + owners: z.array(z.string()).describe('List of owner entity refs'), }), apply: (list: PlaylistMetadata, { owners }) => owners.includes(list.owner), toQuery: ({ owners }) => ({