Class: Checkpoint::DB::Query::ACR
- Inherits:
-
CartesianSelect
- Object
- CartesianSelect
- Checkpoint::DB::Query::ACR
- Defined in:
- lib/checkpoint/db/query/acr.rb
Overview
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.
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Attributes inherited from CartesianSelect
Instance Method Summary collapse
- #conditions ⇒ Object
-
#initialize(agents, credentials, resources, scope: Grant) ⇒ ACR
constructor
A new instance of ACR.
- #parameters ⇒ Object
Methods inherited from CartesianSelect
Constructor Details
#initialize(agents, credentials, resources, scope: Grant) ⇒ ACR
Returns a new instance of ACR.
16 17 18 19 20 21 |
# 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 |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
14 15 16 |
# File 'lib/checkpoint/db/query/acr.rb', line 14 def agents @agents end |
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
14 15 16 |
# File 'lib/checkpoint/db/query/acr.rb', line 14 def credentials @credentials end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
14 15 16 |
# File 'lib/checkpoint/db/query/acr.rb', line 14 def resources @resources end |
Instance Method Details
#conditions ⇒ Object
23 24 25 26 27 28 29 |
# 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 ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/checkpoint/db/query/acr.rb', line 31 def parameters super.merge(Hash[ agent_params.values + credential_params.values + resource_params.values ]) end |