I want to integrate permit for RBAC , we have syst...
# permit-saas
p
I want to integrate permit for RBAC , we have system where our tenants can create multiple enviroment how can i manage this.?
a
Hi @Pratham Khodwe, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
For managing RBAC in a system where tenants can create multiple environments, Permit.io provides a multi-tenant authorization model that maps well to your use case. Tenant Structure in Permit.io In Permit.io, tenants are first-class citizens that represent isolated silos of resources and users (1) . Each tenant is a separate, isolated unit with its own set of users, data, configurations, and permissions (2) . Users are assigned to tenants via roles (1) , and you can have multiple tenants to represent different organizational units. Managing Multiple Environments Permit.io uses a hierarchical structure: Workspace → Projects → Environments (2) (3) . Each environment is a silo of policy and data, usually representing a specific deployment (e.g., dev, prod, staging) (2) . Each PDP (Policy Decision Point) is synced to a specific environment via the secret environment API key . Implementation Approach To indicate a resource belongs to a tenant, provide the tenant key when calling permit.check() (1) :
Copy code
const permitted = await permit.check(userKey, "create", {  
 type: "document", // The resource name  
 tenant: tenantKey, // The tenant key  
}) ;
Users can belong to multiple tenants with different roles in each (4) . For example, a user might be an admin in one tenant while only an editor in another . Key Benefits • ​*Tenant Isolation*​: Each tenant operates in an isolated environment with its own access rules • ​*Dynamic Role Assignment*​: Roles are scoped per tenant, avoiding role explosion • ​*Resource Scoping*​: Resources are linked to specific tenants for proper data boundaries You can manage tenants through the Tenants API and assign users to tenants via the Role-Assignments API (1) .
To learn more, see the sources I considered: [[1] Multi-Tenant Authorization](https://docs.permit.io/concepts/multi-tenant-authorization) [[2] Concepts / Glossary](https://docs.permit.io/overview/glossary) [[3] Workspace Usage](https://docs.permit.io/manage-your-account/workspace-usage) [[4] Best Practices for Multi-Tenant Authorization](https://www.permit.io/blog/best-practices-for-multi-tenant-authorization)
o
Hey @Pratham Khodwe , I guess that the term environment you are talking is in your application, right ? You can define a resource named “environment” in your permit environment and define permissions on that resource
p
yess
o
So my answer about defining the resource is the way to go here, defining a resource named environment and resource instances of it whenever your user create this object Using resource roles and assignments to enforce permissions on the specific environment resources