class Checkpoint::DB::Query::AR
A query object based on agents and resources.
This query finds grants for any supplied agents, for any supplied resources. Its primary purpose is to find which credentials have been granted to an agent on a given resource.
It can take single items or arrays and converts them all to their tokens for query purposes.
Attributes
agents[R]
resources[R]
Public Class Methods
new(agents, resources, scope: Grant)
click to toggle source
Calls superclass method
Checkpoint::DB::CartesianSelect::new
# File lib/checkpoint/db/query/ar.rb, line 16 def initialize(agents, resources, scope: Grant) super(scope: scope) @agents = tokenize(agents) @resources = tokenize(resources) end
Public Instance Methods
conditions()
click to toggle source
Calls superclass method
Checkpoint::DB::CartesianSelect#conditions
# File lib/checkpoint/db/query/ar.rb, line 22 def conditions super.merge( agent_token: agent_params.placeholders, resource_token: resource_params.placeholders ) end
parameters()
click to toggle source
Calls superclass method
Checkpoint::DB::CartesianSelect#parameters
# File lib/checkpoint/db/query/ar.rb, line 29 def parameters super.merge(Hash[ agent_params.values + resource_params.values ]) end
Protected Instance Methods
agent_params()
click to toggle source
# File lib/checkpoint/db/query/ar.rb, line 38 def agent_params Params.new(agents, 'at') end
resource_params()
click to toggle source
# File lib/checkpoint/db/query/ar.rb, line 42 def resource_params Params.new(resources, 'rt') end