Pratham Khodwe
08/07/2025, 5:47 AMAsk Inkeep
08/07/2025, 5:47 AMAsk Inkeep
08/07/2025, 5:47 AMresource := enforcement.ResourceBuilder("document") .WithTenant("tenant") .Build()
const permitted = await permit.check(user, "create", resource) ;
For a complete example with user and resource building :
user := enforcement.UserBuilder("<mailto:john@doe.com|john@doe.com>") .Build()
resource := enforcement.ResourceBuilder("document") .Build()
permitted, err := Permit.Check(user, "create", resource)
if err != nil {
return
}
if permitted {
// Let the user read the resource
} else {
// Deny access
}
When checking permissions for resources within a specific tenant, you need to include the tenant in the resource builder using .WithTenant("tenant") where "tenant" is either the tenant id or tenant key .Ask Inkeep
08/07/2025, 5:47 AMAsk Inkeep
08/07/2025, 7:59 AM