From b2e918fa0bf6e8536f2bd216641426e4527dd9ba Mon Sep 17 00:00:00 2001 From: MT Lewis Date: Mon, 17 Jan 2022 17:46:07 +0000 Subject: [PATCH] search-common: add optional resourceRef field to IndexableDocument type Signed-off-by: MT Lewis --- .changeset/nasty-moose-trade.md | 5 +++++ packages/search-common/api-report.md | 3 +++ packages/search-common/src/types.ts | 11 +++++++++++ 3 files changed, 19 insertions(+) create mode 100644 .changeset/nasty-moose-trade.md diff --git a/.changeset/nasty-moose-trade.md b/.changeset/nasty-moose-trade.md new file mode 100644 index 0000000000..bf101f447c --- /dev/null +++ b/.changeset/nasty-moose-trade.md @@ -0,0 +1,5 @@ +--- +'@backstage/search-common': patch +--- + +Add optional resourceRef field to the IndexableDocument type for use when authorizing access to documents. diff --git a/packages/search-common/api-report.md b/packages/search-common/api-report.md index c4950e3556..dcbbbee1bf 100644 --- a/packages/search-common/api-report.md +++ b/packages/search-common/api-report.md @@ -27,6 +27,9 @@ export interface DocumentDecorator { // // @public export interface IndexableDocument { + authorization?: { + resourceRef: string; + }; location: string; text: string; title: string; diff --git a/packages/search-common/src/types.ts b/packages/search-common/src/types.ts index f73665de5b..bac6967d19 100644 --- a/packages/search-common/src/types.ts +++ b/packages/search-common/src/types.ts @@ -53,6 +53,17 @@ export interface IndexableDocument { * is clicked). */ location: string; + + /** + * Optional authorization information to be used when determining whether this + * search result should be visible to a given user. + */ + authorization?: { + /** + * Identifier for the resource. + */ + resourceRef: string; + }; } /**