The information in my database is structured like a supply chain. Some, but not all, information that tenants create must be available to other tenants down-stream. I have used the OrganizationUnits to construct the relationships between the tenants. I have also created custom filters that work with the OrganizationUnits, such as IncludeTenantChildren, IncludeTenantParent, IncludeTenantBranch, etc.
As I am now working on the more intricate details of my queries, I am finding that there are many times where an initial table determines what data should be seen by a tenant and then other subsequent tables are included in the query to provide additional details. However, those additional details in those subsequent tables come from data maintained by other tenants. Therefore, I need a simple way to state that the TenantId Filter should be applied only to a specific set (0 or more) of tables in the query and the other tables in the query should be treated as if the TenantId filters have been disabled.
As an example, a tenant may create a Package and then transfer the package to another tenant within their Organization. The TenantId on the Package table gets updated to the new tenant during the transfer process. Now, assume that there are two other tables, PackageContent and PackageTracking which both are linked to Package by PackageId. Data in the PackageContent table should be available only to the creator of the package and the recipient of the package. Data in the PackageTracking table should be available to anyone currently holding tenancy of the package.
So you see...having a TenantId filter that applies to all tables in the query will prevent the package recipient from seeing the PackageContent create by a different tenent. And each tenant will be able to see only the tracking records that they create themselves; not the full tracking history.
What's the best way to selectively apply the TenantId to specific tables (such as Package) and then ignore the TenantId filter on other tables (such as PackageContent and PackageTracking)? It is safe to assume that my custom filters are determining when/if it is appropriate to show PackageContent to the recipient.
2 Answer(s)
-
0
Hi,
You can disable multi tenancy filter using https://aspnetboilerplate.com/Pages/Documents/Data-Filters#disable-filters and apply tenantId filter in the tables you want on your query.
-
0
Thank you. The Filter Parameters section in the link you provided appears to describe the desired behavior. I'll investigate further on our next iteration of product development.