DmPolicies
Namespace: MJCZone.DapperMatic.Security
Assembly: MJCZone.DapperMatic
Summary
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.
static public
Contents
Methods (8)
Methods
| Method | Summary |
|---|---|
| Evaluate | Works out what the policies let a caller do to a resource. |
| Limit | Holds rules to the most the caller may do (Limits, an API key's): allowed only if the limits allow... |
| Validate | Refuses a policy that cannot work: a grant for nobody in particular, no actions, or a filter or chec... |
| IsWithin | Tells whether a policy reaches only datasources and schemas that grants of ManageAccess cover: an ... |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
Evaluate
Works out what the policies let a caller do to a resource.
DmAccessRules Evaluate(
DmPolicy} policies,
DmAccessContext context,
DmResource resource,
DmAction action)Parameters
- policies (DmPolicy}) - The policies.
- context (DmAccessContext) - The caller, and the request's tenant and values.
- resource (DmResource) - What the request acts on.
- action (DmAction) - 's single values.
Returns
Type: DmAccessRules
The rules: whether it is allowed, and the filter, check, columns and presets that apply.
Limit
Holds rules to the most the caller may do (Limits, an API key's): allowed only if the limits allow it too; the limits' filters and checks ANDed in, their columns intersected. Limits only take away: their presets are not read, and access management (which keeps policies for every datasource and table) is allowed only by a limit confined to none. Rules of no limits are as they are. Where code decided (rules that allow everything), the limits still hold.
DmAccessRules Limit(
DmAccessRules rules,
DmAccessContext context,
DmResource resource,
DmAction action)Parameters
- rules (DmAccessRules) - What the caller's policies (or code) allow.
- context (DmAccessContext) - The caller.
- resource (DmResource) - What the request acts on.
- action (DmAction) - The action.
Returns
Type: DmAccessRules
The rules within the limits.
Validate
Refuses a policy that cannot work: a grant for nobody in particular, no actions, or a filter or check that is malformed or reads more than the table's own columns and the request's values.
void Validate(DmPolicy policy)Parameters
- policy (DmPolicy) - The policy.
IsWithin
Tells whether a policy reaches only datasources and schemas that grants of ManageAccess cover: an administrator granted access management for some datasources or schemas may keep policies for those, and no others. A grant naming no datasource and no schema covers everything.
bool IsWithin(DmAccessRules managing, String} datasources, String} schemas)Parameters
- managing (DmAccessRules) - , evaluated for every datasource and schema.
- datasources (String}) - The datasources the policy or tenant reaches, by id; empty for every one.
- schemas (String}) - The schemas it reaches, by name; empty for every one.
Returns
Type: bool
True if the grants cover all it reaches.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()