Merge pull request #16253 from backstage/permissions/description-fixes
Updated permission rule descriptions
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-playlist-backend': patch
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Minor improvements to the descriptions provided with permission rules schemas
|
||||
@@ -25,7 +25,7 @@ describe('createPropertyRule', () => {
|
||||
|
||||
it('formats the rule description correctly', () => {
|
||||
expect(description).toBe(
|
||||
'Allow entities which have the specified metadata subfield.',
|
||||
'Allow entities with the specified metadata subfield',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import { z } from 'zod';
|
||||
export const createPropertyRule = (propertyType: 'metadata' | 'spec') =>
|
||||
createCatalogPermissionRule({
|
||||
name: `HAS_${propertyType.toUpperCase()}`,
|
||||
description: `Allow entities which have the specified ${propertyType} subfield.`,
|
||||
description: `Allow entities with the specified ${propertyType} subfield`,
|
||||
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
|
||||
paramsSchema: z.object({
|
||||
key: z
|
||||
|
||||
@@ -28,8 +28,7 @@ import { createCatalogPermissionRule } from './util';
|
||||
*/
|
||||
export const hasAnnotation = createCatalogPermissionRule({
|
||||
name: 'HAS_ANNOTATION',
|
||||
description:
|
||||
'Allow entities which are annotated with the specified annotation',
|
||||
description: 'Allow entities with the specified annotation',
|
||||
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
|
||||
paramsSchema: z.object({
|
||||
annotation: z.string().describe('Name of the annotation to match on'),
|
||||
|
||||
@@ -25,10 +25,10 @@ import { createCatalogPermissionRule } from './util';
|
||||
*/
|
||||
export const hasLabel = createCatalogPermissionRule({
|
||||
name: 'HAS_LABEL',
|
||||
description: 'Allow entities which have the specified label metadata.',
|
||||
description: 'Allow entities with the specified label',
|
||||
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
|
||||
paramsSchema: z.object({
|
||||
label: z.string().describe('Name of the label to match one'),
|
||||
label: z.string().describe('Name of the label to match on'),
|
||||
}),
|
||||
apply: (resource, { label }) =>
|
||||
!!resource.metadata.labels?.hasOwnProperty(label),
|
||||
|
||||
@@ -25,7 +25,7 @@ import { createCatalogPermissionRule } from './util';
|
||||
*/
|
||||
export const isEntityKind = createCatalogPermissionRule({
|
||||
name: 'IS_ENTITY_KIND',
|
||||
description: 'Allow entities with the specified kind',
|
||||
description: 'Allow entities matching a specified kind',
|
||||
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
|
||||
paramsSchema: z.object({
|
||||
kinds: z
|
||||
|
||||
@@ -27,7 +27,7 @@ import { createCatalogPermissionRule } from './util';
|
||||
*/
|
||||
export const isEntityOwner = createCatalogPermissionRule({
|
||||
name: 'IS_ENTITY_OWNER',
|
||||
description: 'Allow entities owned by the current user',
|
||||
description: 'Allow entities owned by a specified claim',
|
||||
resourceType: RESOURCE_TYPE_CATALOG_ENTITY,
|
||||
paramsSchema: z.object({
|
||||
claims: z
|
||||
|
||||
@@ -31,10 +31,10 @@ const createPlaylistPermissionRule = makeCreatePermissionRule<
|
||||
|
||||
const isOwner = createPlaylistPermissionRule({
|
||||
name: 'IS_OWNER',
|
||||
description: 'Should allow only if the playlist belongs to the user',
|
||||
description: 'Allow playlists owned by the given entity refs',
|
||||
resourceType: PLAYLIST_LIST_RESOURCE_TYPE,
|
||||
paramsSchema: z.object({
|
||||
owners: z.array(z.string()).describe('List of owner entity refs'),
|
||||
owners: z.array(z.string()).describe('List of entity refs to match on'),
|
||||
}),
|
||||
apply: (list: PlaylistMetadata, { owners }) => owners.includes(list.owner),
|
||||
toQuery: ({ owners }) => ({
|
||||
@@ -45,7 +45,7 @@ const isOwner = createPlaylistPermissionRule({
|
||||
|
||||
const isPublic = createPlaylistPermissionRule({
|
||||
name: 'IS_PUBLIC',
|
||||
description: 'Should allow only if the playlist is public',
|
||||
description: 'Allow playlists that are set as public',
|
||||
resourceType: PLAYLIST_LIST_RESOURCE_TYPE,
|
||||
apply: (list: PlaylistMetadata) => list.public,
|
||||
toQuery: () => ({ key: 'public', values: [true] }),
|
||||
|
||||
Reference in New Issue
Block a user