Okay, I know I can filter what collections are included in LinkFeature for lexical RichText editing. That's good. But, how do I filter further the documents within the collection.
My scenario:
My site is multi-tenant so there is a Tenant collection and every document is bound to a tenant collection. If adding a Link to the RichText content, I only want the user to be able to select a document from the same tenant the referencing document is in (it's all the same collection).
I know I can exclude other collections, of course security will limit only to those documents that the user has access to. However, when adding a link to a document in Tenant A, I only want Tenant A content to show up (even if the user has access to other tenants -- which my content team always will have). This prevent errors.
Do I need to rewrite LinkFeature to do this or is there a config I can use (if not why not)?
Example:
This document is in the "Nuevco" teannat. Right now it can create links to documents in both the Nuevco and Denice tenants (for testing I only setup two tenants). This is because I have access to both tenants, but documents from the Nuevco tenant should not be able to internal link to documents of the Denice tenant (an external link is fine if we want to do that but then the user will have to provide the full URL).
It would be nice if in addition to enabledCollections there was a filter handler.
With almost any level of hook this would be easy, either (a) the ability to create a Where clause for each collection based on the filter or (b) the ability to be called with both documents to see if it's acceptable.
NOTE: Option A would probably be most performant.