aboutsummaryrefslogtreecommitdiff
blob: 4077653d526ab814f6fdbc28bdd0f18a4e5eeda3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#   Gentoo Council Web App - to help Gentoo Council do their job better
#   Copyright (C) 2011 Joachim Filip Bartosik
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as
#   published by the Free Software Foundation, version 3 of the License
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

class AgendasController < ApplicationController

  hobo_model_controller

  before_filter :authenticate_bot, :only => :results
  auto_actions :all

  def index
    hobo_index Agenda.state_is(:old)
  end

  def current_items
    render :json => Agenda.current.voting_array
  end

  def results
    data = JSON.parse(request.env['rack.input'].read)
    Agenda.update_voting_options data['agenda']
    Agenda.process_results data data['votes']
    agenda = Agenda.current
    agenda.meeting_log = data['lines']
    Participation.mark_participations data
  end

  def reminders
    render :json => Agenda.irc_reminders
  end

  private
    def authenticate_bot
      botconf = CustomConfig['Bot']
      authenticate_or_request_with_http_basic do |user_name, password|
        user_name == botconf['user'] && password == botconf['password']
      end
    end
end