DmPolicyExtensions
Namespace: MJCZone.DapperMatic.Security
Assembly: MJCZone.DapperMatic
Summary
Narrows a policy, fluently: <c>DmPolicy.Allow(DmAction.ReadWrite, "staff").InSchemas("sales").Where("tenant_id eq @tenant.id")</c>.
static public
Contents
Methods (20)
Methods
| Method | Summary |
|---|---|
| Named | Names the policy, as effective permissions show it. |
| WithClaim | Requires a claim of the caller: a value, or <c>*</c> for any. |
| When | Applies the policy only to requests whose context satisfies a predicate: in code, with the caller, t... |
| OnDatasources | Covers only these datasources, by id or pattern with <c>*</c>. |
| InSchemas | Covers only these schemas, by name or pattern; <c>_</c> is the default schema of a reque... |
| ExceptSchemas | Leaves out these schemas, by name or pattern. |
| OnTables | Covers only these tables and views, by name or pattern. |
| OnFunctions | Covers running only these functions, by name or pattern. A policy naming functions grants Execute ... |
| ExceptTables | Leaves out these tables and views, by name or pattern. |
| OnTablesWithColumns | Covers, for row actions, only tables having all these columns: one policy for every table with a <... |
| OnlyColumns | Lets callers read and write only these columns. |
| ExceptColumns | Keeps these columns from callers. |
| Where | Limits the rows read, updated and deleted, with a condition in the query syntax over the table's own... |
| WithinOwnTenant | Makes a grant of ManageAccess one for the caller's own tenant: its holders keep policies that belo... |
| Check | Sets a condition every row inserted or updated must satisfy, in the query syntax. |
| Preset | Writes a column on insert and update whatever the request says: a value of the request's context suc... |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
Named
Names the policy, as effective permissions show it.
DmPolicy Named(DmPolicy policy, string name)Parameters
- policy (DmPolicy) - The policy to change.
- name (string) - The name.
Returns
Type: DmPolicy
The same policy, for chaining.
WithClaim
Requires a claim of the caller: a value, or <c>*</c> for any.
DmPolicy WithClaim(DmPolicy policy, string type, string value)Parameters
- policy (DmPolicy) - The policy to change.
- type (string) - The claim type.
- value (string) - .
Returns
Type: DmPolicy
The same policy, for chaining.
When
Applies the policy only to requests whose context satisfies a predicate: in code, with the caller, the tenant, and the request's services for anything else.
DmPolicy When(DmPolicy policy, DmAccessContext predicate)Parameters
- policy (DmPolicy) - The policy to change.
- predicate (DmAccessContext) - The predicate.
Returns
Type: DmPolicy
The same policy, for chaining.
OnDatasources
Covers only these datasources, by id or pattern with <c>*</c>.
OnDatasources(DmPolicy policy, String[] datasources)Parameters
- policy (DmPolicy) - The policy to change.
- datasources (String[]) - The datasources.
Returns
The same policy, for chaining.
InSchemas
Covers only these schemas, by name or pattern; <c>_</c> is the default schema of a request naming none.
InSchemas(DmPolicy policy, String[] schemas)Parameters
- policy (DmPolicy) - The policy to change.
- schemas (String[]) - The schemas.
Returns
The same policy, for chaining.
ExceptSchemas
Leaves out these schemas, by name or pattern.
ExceptSchemas(DmPolicy policy, String[] schemas)Parameters
- policy (DmPolicy) - The policy to change.
- schemas (String[]) - The schemas.
Returns
The same policy, for chaining.
OnTables
Covers only these tables and views, by name or pattern.
OnTables(DmPolicy policy, String[] tables)Parameters
- policy (DmPolicy) - The policy to change.
- tables (String[]) - The tables.
Returns
The same policy, for chaining.
OnFunctions
Covers running only these functions, by name or pattern. A policy naming functions grants Execute and nothing else.
OnFunctions(DmPolicy policy, String[] functions)Parameters
- policy (DmPolicy) - The policy to change.
- functions (String[]) - The functions.
Returns
The same policy, for chaining.
ExceptTables
Leaves out these tables and views, by name or pattern.
ExceptTables(DmPolicy policy, String[] tables)Parameters
- policy (DmPolicy) - The policy to change.
- tables (String[]) - The tables.
Returns
The same policy, for chaining.
OnTablesWithColumns
Covers, for row actions, only tables having all these columns: one policy for every table with a <c>tenant_id</c>, in whatever schema.
OnTablesWithColumns(DmPolicy policy, String[] columns)Parameters
- policy (DmPolicy) - The policy to change.
- columns (String[]) - The columns.
Returns
The same policy, for chaining.
OnlyColumns
Lets callers read and write only these columns.
OnlyColumns(DmPolicy policy, String[] columns)Parameters
- policy (DmPolicy) - The policy to change.
- columns (String[]) - The columns.
Returns
The same policy, for chaining.
ExceptColumns
Keeps these columns from callers.
ExceptColumns(DmPolicy policy, String[] columns)Parameters
- policy (DmPolicy) - The policy to change.
- columns (String[]) - The columns.
Returns
The same policy, for chaining.
Where
Limits the rows read, updated and deleted, with a condition in the query syntax over the table's own columns and values of the request: <c>tenant_id eq null or tenant_id in @tenant.below</c>.
DmPolicy Where(DmPolicy policy, string filter)Parameters
- policy (DmPolicy) - The policy to change.
- filter (string) - The condition.
Returns
Type: DmPolicy
The same policy, for chaining.
WithinOwnTenant
Makes a grant of ManageAccess one for the caller's own tenant: its holders keep policies that belong to their tenant, held to its rows, giving no more than they may do themselves.
DmPolicy WithinOwnTenant(DmPolicy policy)Parameters
- policy (DmPolicy) - The policy to change.
Returns
Type: DmPolicy
The same policy, for chaining.
Check
Sets a condition every row inserted or updated must satisfy, in the query syntax.
DmPolicy Check(DmPolicy policy, string check)Parameters
- policy (DmPolicy) - The policy to change.
- check (string) - The condition.
Returns
Type: DmPolicy
The same policy, for chaining.
Preset
Writes a column on insert and update whatever the request says: a value of the request's context such as <c>@tenant.id</c>, or a fixed text.
DmPolicy Preset(DmPolicy policy, string column, string value)Parameters
- policy (DmPolicy) - The policy to change.
- column (string) - The column.
- value (string) - The value.
Returns
Type: DmPolicy
The same policy, for chaining.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()