2014-09-17 12:43:17 +03:00
|
|
|
module Management
|
|
|
|
class ManagementController < ::ApplicationController
|
2014-09-17 14:30:50 +03:00
|
|
|
before_action :authenticate_user!, :authorize_user!
|
|
|
|
|
2014-09-17 12:43:17 +03:00
|
|
|
layout 'management'
|
2014-09-17 14:30:50 +03:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2015-05-30 17:07:57 +03:00
|
|
|
def current_conference?
|
|
|
|
session[:current_conference_id] and current_conference.present?
|
|
|
|
end
|
|
|
|
helper_method :current_conference?
|
|
|
|
|
|
|
|
def current_conference
|
|
|
|
@current_conference ||= Conference.find(session[:current_conference_id])
|
|
|
|
end
|
|
|
|
helper_method :current_conference
|
|
|
|
|
|
|
|
def set_current_conference(conference)
|
|
|
|
session[:current_conference_id] = conference.id
|
|
|
|
end
|
|
|
|
|
2014-09-17 14:30:50 +03:00
|
|
|
def authorize_user!
|
|
|
|
head :forbidden unless current_user.admin?
|
|
|
|
end
|
2014-09-17 12:43:17 +03:00
|
|
|
end
|
|
|
|
end
|