Class Policy

Access policy class.

Defines how entity access is controlled; includes zero or more statements.

Hierarchy

  • Policy

Constructors

  • Policy object constructor.

    Parameters

    • baseDirectory: string

      Application base path.

    • id: string

      Policy id.

    Returns Policy

Properties

_baseDirectory: string
_id: string
_processPolicyData: any

Reads policy data and initializes statements list.

Param

_statements: any[]
_validatePolicySchema: any

Validates policy data against JSONSchema.

Param

Methods

  • Merge two policy definitions into one.

    The second policy definition can override parts of the first by reusing the same statement IDs ('sid'). The normal use case is that the first (base) policy is an automatically generated one, and the second (override) is defined in the YAML configuration.

    Returns

    Parameters

    • base: any
    • override: any

    Returns any

  • Checks if given statement handles an action.

    Returns

    Parameters

    • statement: __module

      {Statement} - policy statement object.

    • action: string

      {string} - the action.

    Returns boolean

  • Checks if this Policy handles given entity action.

    Returns

    Parameters

    • action: string

      {string} - the entity action.

    Returns boolean

  • Validates action against the policy.

    Returns

    Parameters

    • userContext: any
    • action: string

      {string}

    Returns boolean

  • Validates action statement.

    Returns

    Parameters

    • statement: __module

      {Statement}

    • userContext: any
    • action: string

      {string}

    Returns boolean

Generated using TypeDoc