MJCZone.DapperMatic.Security
Assembly: MJCZone.DapperMatic
Classes
| Name | Description |
|---|---|
| DmAccessContext | Who a request is, and for which tenant: what policies decide on and what their filters, checks and presets read as <c>@user.id</c>, <c>@claims.role</c>, <c>@tenant.id</c>, <c>@tenant.below</c> or <c>@values.region</c>. |
| DmAccessRules | What the policies allow one caller to do to one resource. |
| DmPolicies | Evaluates policies, PostgreSQL-style: an action is allowed when a permissive policy grants it; the permissive policies' filters are ORed and every restrictive policy's filter is ANDed on top. |
| DmPolicy | Who may do what, to which tables, rows and columns. Nothing is allowed unless a permissive policy grants it. |
| DmPolicyExtensions | Narrows a policy, fluently: <c>DmPolicy.Allow(DmAction.ReadWrite, "staff").InSchemas("sales").Where("tenant_id eq @tenant.id")</c>. |
| DmSession | Sets values on a connection's session, for the database's own row-level security to read: on PostgreSQL with <c>set_config</c>, read by policies as <c>current_setting('app.tenant_id', true)</c>; on SQL Server with <c>sp_set_session_context</c>, read-only, read as <c>SESSION_CONTEXT(N'tenant_id')</c>; on MySQL and MariaDB as user variables, read as <c>@tenant_id</c>, which needs <c>AllowUserVariables=True</c> in the connection string (MySQL views cannot read variables; a function that returns one can). |
| DmTenant | The tenant a request acts for, and what is known about it. Nothing here assumes a tenant model: a tenant may be a key on rows, a schema, a database, a node of a tree, or any mix; policies and session values read what they need. |
Enums
| Name | Description |
|---|---|
| DmAction | What a policy lets callers do. Written in JSON by name: <c>"Read, Create"</c>. |
| DmPolicyKind | How a policy combines with others, as in PostgreSQL: permissive policies grant, and any one of them is enough; restrictive policies fence, and every one of them must hold. |
Delegates
| Name | Description |
|---|---|
| DmValueProvider | Computes a value of an access context when it is first read, such as the ids of the tenants below the request's. |