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; + }; } /**