class Checkpoint::DB::Query::ACR

A query object based on agents, credentials, and resources.

This query mirrors the essence of the Checkpoint semantics; that is, it finds grants for any supplied agents, for any supplied credentials, for any supplied resources.

It can take single items or arrays and converts them all to their tokens for query purposes.

Attributes

agents[R]
credentials[R]
resources[R]

Public Class Methods

new(agents, credentials, resources, scope: Grant) click to toggle source
Calls superclass method Checkpoint::DB::CartesianSelect::new
# File lib/checkpoint/db/query/acr.rb, line 16
def initialize(agents, credentials, resources, scope: Grant)
  super(scope: scope)
  @agents      = tokenize(agents)
  @credentials = tokenize(credentials)
  @resources   = tokenize(resources)
end

Public Instance Methods

conditions() click to toggle source
# File lib/checkpoint/db/query/acr.rb, line 23
def conditions
  super.merge(
    agent_token:      agent_params.placeholders,
    credential_token: credential_params.placeholders,
    resource_token:   resource_params.placeholders
  )
end
parameters() click to toggle source
# File lib/checkpoint/db/query/acr.rb, line 31
def parameters
  super.merge(Hash[
    agent_params.values +
    credential_params.values +
    resource_params.values
  ])
end

Protected Instance Methods

agent_params() click to toggle source
# File lib/checkpoint/db/query/acr.rb, line 41
def agent_params
  Params.new(agents, 'at')
end
credential_params() click to toggle source
# File lib/checkpoint/db/query/acr.rb, line 45
def credential_params
  Params.new(credentials, 'ct')
end
resource_params() click to toggle source
# File lib/checkpoint/db/query/acr.rb, line 49
def resource_params
  Params.new(resources, 'rt')
end