hi, i have a question about the checkAllTenants fu...
# permit-saas
t
hi, i have a question about the checkAllTenants function in Node.js SDK. is it currently deprecated? i want to have multi-tenant functionality but still sharing the same resource instances across the tenants. so i am wondering if there is a method for that where Tenant 1 can access Tenant 2's resource instances and vice versa
a
Hi @Tamara, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
* The
checkAllTenants
method is available in the Node.js SDK. Based on the source code, it returns an array of
TenantDetails
representing all tenants where the user has the specified permission:
Copy code
public async checkAllTenants(
  user: IUser | string,
  action: string,
  resource: IResource | string,
  context?: Context | undefined,
  sdk?: string | undefined,
) : Promise<TenantDetails[]>
(1) I don't see any indication that this method is deprecated in the available sources. ​*Regarding cross-tenant resource instance access:*​ The standard multi-tenant design in Permit.io scopes resource instances to specific tenants for isolation purposes. When creating resource instances, they are typically linked to a tenant (2) :
Copy code
await permit.api.resourceInstances.create({
  key: 'order_456',
  resource: 'Order',
  attributes: { fulfilled: false, delivered: false },
  tenant: 'California'
}) ;
For your use case of sharing resource instances across tenants, I don't have explicit documentation on a built-in method for cross-tenant resource sharing. This is a more advanced scenario that may require a different modeling approach. I'd recommend reaching out via Email to discuss your specific architecture needs for cross-tenant resource sharing. Would you like me to try to provide a general answer based on authorization patterns, or do you have additional context about your use case?
Thanks for the feedback, glad I was helpful.