Class: Decidim::ActionDelegator::AuthorizedResources
- Inherits:
-
Query
- Object
- Query
- Decidim::ActionDelegator::AuthorizedResources
- Defined in:
- app/queries/decidim/action_delegator/authorized_resources.rb
Instance Method Summary collapse
- #components ⇒ Object
-
#initialize(setting:) ⇒ AuthorizedResources
constructor
Finds all the resources that have configured the action delegator verifier Note that currently only returns elections (Decidim::Election) In the future components could be returned here as well.
- #query ⇒ Object
Constructor Details
#initialize(setting:) ⇒ AuthorizedResources
Finds all the resources that have configured the action delegator verifier Note that currently only returns elections (Decidim::Election) In the future components could be returned here as well
9 10 11 |
# File 'app/queries/decidim/action_delegator/authorized_resources.rb', line 9 def initialize(setting:) @setting = setting end |
Instance Method Details
#components ⇒ Object
23 24 25 |
# File 'app/queries/decidim/action_delegator/authorized_resources.rb', line 23 def components Decidim::PublicComponents.for(@setting.organization, manifest_name: "elections") end |
#query ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/queries/decidim/action_delegator/authorized_resources.rb', line 13 def query condition = [ "(census_manifest = 'internal_users' AND census_settings -> 'authorization_handlers' -> 'delegations_verifier' -> 'options' -> 'setting' ? :setting_id) OR " \ "(census_manifest = 'action_delegator_census' AND census_settings ->> 'setting_id' = :setting_id)", { setting_id: @setting.id.to_s } ] Decidim::Elections::Election.where(component: components).where(condition) end |