Class PrivacyPolicyRule<TFields, TID, TViewerContext, TEntity, TSelectedFields>Abstract

A single unit of which declarative privacy policies are composed, allowing for simple expression and testing of authorization logic.

Remarks

Each rule is responsible for returning a ruling of ALLOW, DENY, or SKIP for a condition that it is checking for. While rules can return any of these, it is most common for rules to return ALLOW or SKIP, explicitly authorizing or deferring authorization to the next rule in the privacy policy. If all rules in the policy SKIP, the policy is denied.

Returning DENY from a rule is useful in a few notable cases:

  • Preventing a CRUD action on an entity (AlwaysDenyPrivacyPolicyRule)
  • Blocking. For example, a user blocks another user from seeing their posts, and the rule would be named something like DenyIfViewerHasBeenBlockedPrivacyPolicyRule.

Type Parameters

  • TFields extends object

  • TID extends NonNullable<TFields[TSelectedFields]>

  • TViewerContext extends ViewerContext

  • TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>

  • TSelectedFields extends keyof TFields = keyof TFields

Hierarchy

Constructors

Methods

Constructors

  • Type Parameters

    • TFields extends object

    • TID extends {}

    • TViewerContext extends ViewerContext<TViewerContext>

    • TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields, TEntity>

    • TSelectedFields extends string | number | symbol = keyof TFields

    Returns PrivacyPolicyRule<TFields, TID, TViewerContext, TEntity, TSelectedFields>

Methods

Generated using TypeDoc