Engineering Swantide
11/10/2025, 6:17 PMdefault tenant? i'm noticing that in some of my other apis, when I withold tenant,it doesn't append anything to the 'default' tenant only my other one created. Do I always have to enforce default tenant at all times if I only want one?Ask Inkeep
11/10/2025, 6:18 PMAsk Inkeep
11/10/2025, 6:18 PMdefaultTenant setting that defaults to "default" and a useDefaultTenantIfEmpty flag that defaults to true (1) .
// multi tenancy config
private String defaultTenant = "default";
private Boolean useDefaultTenantIfEmpty = true;
The PermitConfig documentation explains that getDefaultTenant() returns "the key of the default tenant used for permission checks if a tenant is not specified (or known) for the resource provided to permit.check() " and shouldUseDefaultTenantIfEmpty() returns "whether the default tenant should be used if the resource tenant is not specified" .
This means when you don't specify a tenant in your API calls, it should automatically use the "default" tenant. If you're seeing users being created without tenant assignments when you omit the tenant parameter, this might be unexpected behavior.
To ensure users are always assigned to the default tenant, you have a couple of options:
1. Explicitly include the tenant in your API calls - for example, when creating or syncing users, include "tenant": "default" (2)
2. Include role assignments during user creation with the tenant specified :
role_assignments: [{ role: "manager", tenant: "default" }];
If you're experiencing different behavior where omitting the tenant doesn't default to "default", this could be a configuration issue or potentially a bug in your implementation.Ask Inkeep
11/10/2025, 6:18 PMEngineering Swantide
11/10/2025, 6:18 PMnode sdkAsk Inkeep
11/10/2025, 6:19 PMOr Weis
11/10/2025, 6:40 PMAsk Inkeep
11/10/2025, 6:41 PMAsk Inkeep
11/10/2025, 6:41 PMnormalizeResource method shows how the SDK handles empty tenants (1) :
private normalizeResource(resource: IResource) : IResource {
const normalizedResource: IResource = Object.assign({}, resource) ;
// if tenant is empty, we might auto-set the default tenant according to config
if (!normalizedResource.tenant && this.config.multiTenancy.useDefaultTenantIfEmpty) {
normalizedResource.tenant = this.config.multiTenancy.defaultTenant;
}
return normalizedResource;
}
This shows that the Node.js SDK does have multiTenancy.useDefaultTenantIfEmpty and multiTenancy.defaultTenant configuration options that should automatically apply the default tenant when none is specified .
However, this normalization appears to only apply to the check() enforcement methods in the enforcer . The API client methods for user creation and role assignments (in the /api directory) don't show the same automatic default tenant application (2) .
This means:
• For permission checks (permit.check()) , omitting the tenant should default to "default" if configured
• For API operations like user creation or role assignments, you may need to explicitly specify the tenant
If you're experiencing inconsistent behavior where some API endpoints don't respect the default tenant setting, you should explicitly include tenant: "default" in your API calls to ensure consistent behavior across all operations.
To help our engineers investigate this potential inconsistency:
1. Which Workspace / Project / Env are you using?
2. What specific API calls are you making (please share the SDK code) ?
3. Which PDP version are you running?
4. Could you share relevant logs from your PDP showing the behavior?Ask Inkeep
11/10/2025, 6:41 PMOr Weis
11/10/2025, 6:41 PMEngineering Swantide
11/10/2025, 6:44 PMmultiTenancy: {
defaultTenant: 'default'
},
doesn't appear to work for the methods i'm working with. So far, it only seems to be permit.api.roleAssignments.bulkUnassign(allMembersToRemove) the one I shared previously. of the IRoleAssignmentsApi.blukAssign in permitio/build/api/role-assignmentsOr Weis
11/10/2025, 6:46 PMEngineering Swantide
11/10/2025, 6:47 PMpermit.api.resourceInstances.create that also has tenant as optional, but when I exclude it, it doesn't upsert into default tenant ( Its the only tenant now available after deleting the other one) While it doesn't fail it doesn't upsert to what I would expect to be the default tenant, I must pass in default to tenant (even though its optional)Engineering Swantide
11/10/2025, 6:47 PMEngineering Swantide
11/10/2025, 6:48 PMEngineering Swantide
11/10/2025, 6:48 PMtenant?Or Weis
11/10/2025, 6:50 PMtenant to "default"
But yes it sounds in some of these APIs you have to pass in tenantOr Weis
11/10/2025, 6:51 PMEngineering Swantide
11/10/2025, 6:52 PM