Authorization for resource creation presents a classic challenge: how do you authorize users to create resources when authorization typically depends on permissions granted after those resources exist? The solution depends on your resource hierarchy: This guide demonstrates both RBAC and ReBAC patterns for resource creation.Documentation Index
Fetch the complete documentation index at: https://www.osohq.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Bootstrapping root-level resources
Most Polar policies center around a root-level resource that serves as the foundation for all other resources:- Multi-tenant SaaS applications:
resource Organization - Consumer applications:
actor User
Use the global block
Create aglobal block that allows specific roles to create root-level resources.
global admin role with create_org permission. Global admins can create organizations even when no other resources exist.
Next, seed your authorization facts with data providing some users the global role you defined. Typically, this will be a user of your team who should have privileges elevated beyond most other users.
For example, the above policy would require data like:
Parent-child resources
Another common pattern for authorizing resource creation is to check the parent resource’s permissions.Further resources
- RBAC patterns for role-based authorization
- ReBAC patterns for relationship-based authorization
- Facts overview for managing facts in Oso Cloud