Class: Decidim::Consultations::Admin::AdminUsers

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-consultations/app/queries/decidim/consultations/admin/admin_users.rb

Overview

A class used to find the admins for a participatory process including organization admins.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consultation) ⇒ AdminUsers

Initializes the class.

consultation - a consultation that needs to find its process admins


19
20
21
# File 'decidim-consultations/app/queries/decidim/consultations/admin/admin_users.rb', line 19

def initialize(consultation)
  @consultation = consultation
end

Class Method Details

.for(consultation) ⇒ Object

Syntactic sugar to initialize the class and return the queried objects.

consultation - a process that needs to find its process admins


12
13
14
# File 'decidim-consultations/app/queries/decidim/consultations/admin/admin_users.rb', line 12

def self.for(consultation)
  new(consultation).query
end

Instance Method Details

#queryObject

Finds organization admins and the users with role admin for the given process.

Returns an ActiveRecord::Relation.


26
27
28
# File 'decidim-consultations/app/queries/decidim/consultations/admin/admin_users.rb', line 26

def query
  Decidim::User.where(id: organization_admins)
end