Guides
Model FGA for multi-tenant apps
Design resource types, roles, and a hierarchy that matches your product.
You'll learn how to define resource types, permissions, roles, and grants for a typical multi-tenant app.
ISqlOSFgaDbContext on your DbContextTenants own workspaces; workspaces contain projects; roles granted at the workspace level inherit to projects.
options.Fga.Seed(seed =>
{
seed.ResourceType("workspace", "Workspace");
seed.ResourceType("project", "Project");
seed.Permission("perm_project_read", "project.read", "Read project", "project");
seed.Role("role_workspace_admin", "workspace_admin", "Workspace Admin");
seed.RolePermission("workspace_admin", "project.read");
});Create resource instances when your app creates domain rows (see Creating resources).
Assign grants at the right node — a grant on a workspace applies to descendant projects automatically.
Open /sqlos/admin/fga/ to inspect the tree, grants, and access tester.
The retail example in examples/SqlOS.Example.Api (FgaRetail) shows chain → store → inventory hierarchies.