Skip to content

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 ​

MethodSummary
EvaluateWorks out what the policies let a caller do to a resource.
LimitHolds rules to the most the caller may do (Limits, an API key's): allowed only if the limits allow...
ValidateRefuses a policy that cannot work: a grant for nobody in particular, no actions, or a filter or chec...
IsWithinTells 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.

csharp
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.

csharp
DmAccessRules Limit(
    DmAccessRules rules,
    DmAccessContext context,
    DmResource resource,
    DmAction action)

Parameters ​

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.

csharp
void Validate(DmPolicy policy)

Parameters ​

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.

csharp
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 ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()