Module: Omen::Narrowed

Extended by:
ActiveSupport::Concern
Included in:
Reading
Defined in:
app/models/omen/narrowed.rb

Overview

Extends Omen::Reading with the audience it is asked by: what that audience may read, and the Postgres role that holds it there.

Instance Method Summary collapse

Instance Method Details

#runs_as ⇒ String

Returns Postgres role the statement runs as, which holds what it may read.

Returns:

  • (String) —

    Postgres role the statement runs as, which holds what it may read.



31
# File 'app/models/omen/narrowed.rb', line 31

def runs_as = narrowing&.role || Omen.config.narrow_role

#settings ⇒ Hash

Returns what is set before the statement, for a row policy of the host's to read.

Returns:

  • (Hash) —

    what is set before the statement, for a row policy of the host's to read.



34
# File 'app/models/omen/narrowed.rb', line 34

def settings = narrowing ? { narrowing.setting => self[narrowing.by] } : {}