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