hi Permit, i want to ask what is the behaviour of ...
# permit-saas
t
hi Permit, i want to ask what is the behaviour of a default tenant? i want to run this permit.check, where the resource instance ResourceA is in Tenant X. i'm wondering if i do a permit.check of ResourceA without specifying which tenant it's from, will it return true/false successfully or will it be an error message?
a
Hi @Tamara, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
When running
permit.check()
for a resource instance that belongs to a specific tenant, you should pass the tenant as part of the resource object. (1) , (2) , (3) The tenant passed in needs to be either the ​*tenant id*​ or the ​*tenant key*​. (1) To indicate a resource belongs to a tenant, provide the tenant key (or id) as part of the resource object:
Copy code
const permitted = await permit.check(userKey, "create", {
  type: "document", // The resource name
  tenant: tenantKey, // The tenant key
}) ;
(3) Tenants act as ​*silos of resources and users*​ — only users within a tenant can act on resources within that tenant. Tenants are isolated from one another. I don't have explicit documentation on what happens if you omit the tenant when checking a resource instance that belongs to a specific tenant (Tenant X) . The sources don't specify whether it returns
false
, throws an error, or falls back to a default tenant in that scenario. Check out these potentially useful sources: • Multi-Tenant Authorization • Permit.check() • Running a demo Would you like me to provide a general answer based on my knowledge, or would you prefer to test this behavior directly?
To learn more, see the sources I considered: [[1] Running a demo](https://docs.permit.io/overview/connecting-your-app) [[2] Permit.check()](https://docs.permit.io/how-to/enforce-permissions/check) [[3] Multi-Tenant Authorization](https://docs.permit.io/concepts/multi-tenant-authorization)
t
@Ask Inkeep i would prefer to test this behaviour directly. there is no explicit documentation that i can find as well on that
a
Thanks for tagging me @Tamara. I'll look through relevant sources and get back to you shortly.
* That's a good approach — testing directly is the best way to confirm the exact behavior. To test, you can run a
permit.check()
call both with and without the tenant specified and compare the results: ​*With tenant specified:*​
Copy code
const permitted = await permit.check(userKey, "create", {
  type: "document",
  tenant: tenantKey,
}) ;
(1) , (2) ​*Without tenant specified:*​
Copy code
const permitted = await permit.check("<mailto:john@permit.io|john@permit.io>", "create", "document") ;
(1) This will help you observe whether omitting the tenant returns
false
, throws an error, or has other behavior. To help our engineers investigate if you encounter unexpected results, could you share: 1. Which Workspace / Project / Env you are using 2. What calls you are performing (as SDK code or CURL) 3. Which PDP version you are running 4. Relevant logs from your PDP This information will help us clarify the default tenant behavior for your specific setup.
To learn more, see the sources I considered: [[1] Running a demo](https://docs.permit.io/overview/connecting-your-app) [[2] Multi-Tenant Authorization](https://docs.permit.io/concepts/multi-tenant-authorization)
t
1. i am using development env in my project 2. i am using sdk code, specifically with node js and ts 3. running pdp-v2/0.9.8 via Docker
a
Hey @Tamara If you haven’t tested it yet, it might be helpful to try running
permit.check
both with and without specifying the tenant to see the exact behavior in your setup.