Implement role authorization

This commit is contained in:
Stella Rouzi 2014-08-12 11:51:59 +03:00
parent 6755328c4c
commit e2fb434dc7
122 changed files with 1386 additions and 751 deletions

View file

@ -1,10 +1,14 @@
module Admin
class SchedulesController < ApplicationController
before_filter :verify_organizer
# By authorizing 'conference' resource, we can ensure there will be no unauthorized access to
# the schedule of a conference, which should not be accessed in the first place
load_and_authorize_resource :conference, find_by: :short_title
skip_before_filter :verify_authenticity_token, only: [:update]
layout 'schedule'
def show
authorize! :update, @conference.events.new
if @conference.nil?
redirect_to admin_conference_index_path
return
@ -14,6 +18,7 @@ module Admin
end
def update
authorize! :update, @conference.events.new
event = Event.where(guid: params[:event]).first
error_message = nil
if event.nil?