FGA Overview
Hierarchical authorization for .NET apps, evaluated in SQL.
FGA models resources as a tree. You grant roles on a node. Child nodes inherit access. A list endpoint reads one authorized page from SQL Server or PostgreSQL; a detail endpoint checks one resource. You do not load everything and filter in memory.

Designing your resource tree explains grant placement, groups, and query performance, including what a page costs. Paginating authorized lists covers ToPageAsync and the one rule it needs: index the columns you sort by.
Define resources (projects, chains, stores), roles (admin, viewer), and permissions (VIEW, EDIT). Grant a role to a user on a resource. Every descendant of that resource inherits the grant.
Organizations, projects, chains, stores, or any hierarchy you define.
Attach reusable permission bundles to a resource and inherit them downward.
Read the page a caller may see in SQL instead of loading data and trimming it in memory.
The core feature. Instead of loading all records and filtering in memory, a list endpoint reads one authorized page of its EF Core query:
var page = await dbContext.Chains
.OrderBy(c => c.Name)
.ToPageAsync(subjectId, "CHAIN_VIEW", pageSize: 20, cursor, ct);
return Results.Ok(page.ToResponse(c => new ChainDto(c.Id, c.Name)));Users only see rows they may access. SqlOS checks rows with the recursive authorization function on SQL Server or PostgreSQL. Index the order, HasIndex(c => new { c.Name, c.Id }), and a page costs about a page for any caller: SqlOS keeps a copy of every index under every node of the resource tree. SqlOS has no authorized count or join, because those cost every row the caller can see; page instead. See Authorized pages.
Company Admin sees 5 chains:

Store Clerk sees 0 chains (only their store):

builder.AddSqlOS<AppDbContext>();
var app = builder.Build();/sqlos/admin/fga/resources — browse resources, grants, roles, permissions, and run the access tester through the unified dashboard.

The value proposition is not just expressive permissions. It is that the same authorization model can drive authorized pages, detail checks, dashboard inspection, and SQL-native enforcement from one runtime.
| Concept | Description |
|---|---|
| Resource | A node in the hierarchy (org, project, store) |
| Subject | Who is being authorized (user, agent, service account) |
| Role | A named set of permissions (viewer, editor, admin) |
| Permission | A capability key (CHAIN_VIEW, INVENTORY_EDIT) |
| Grant | Links subject + role + resource; inherits downward |