Class: Decidim::Conferences::Admin::AdminUsers

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

Overview

A class used to find the admins for an conference.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conference) ⇒ AdminUsers

Initializes the class.

conference - an conference that needs to find its conference admins


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

def initialize(conference)
  @conference = conference
end

Class Method Details

.for(conference) ⇒ Object

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

conference - an conference that needs to find its conference admins


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

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

Instance Method Details

#queryObject

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

Returns an ActiveRecord::Relation.


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

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