Skip to contents

policy_decide() works out what the policy does with each identifier in a request to destination, without changing the text. policy_apply() also rewrites the text when the request is allowed: identifiers to redact become placeholders such as [PAN], identifiers to tokenise become tokens from vault. A blocked request gets no text: nothing may be sent.

Usage

policy_decide(policy, text, destination)

policy_apply(policy, text, destination, vault = NULL, audit = NULL)

Arguments

policy

A policy from cg_policy().

text

The texts of one request (for example the messages of a chat).

destination

Name of a destination in the policy; an unknown one is an error.

vault

A vault from cg_vault(), needed when the policy tokenises.

audit

An audit log from cg_audit_log(): the decision is recorded, blocked or not.

Value

An object of class cg_decision: a list with policy_id, policy_revision, destination, tier, provider, url, allowed, blocked_by ("destination-blocked" and rule ids), matches (a data frame of the identifiers with their action and deciding rule, "default" when no rule matched) and text (the rewritten texts, or NULL).