From b95d35d5d95086c8305cefac48c3f19cbe46c2a8 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 6 Nov 2014 14:58:51 +0100 Subject: [PATCH] It's always hard to remove another layer of indirection... --- app/controllers/application_controller.rb | 11 ----------- .../conference_registrations_controller.rb | 2 +- app/controllers/proposal_controller.rb | 2 +- app/controllers/ticket_purchases_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a6a14473..59a9c552 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -38,17 +38,6 @@ class ApplicationController < ActionController::Base @conferences =Conference.all end - def verify_user - :authenticate_user! - - if (current_user.nil?) - redirect_to new_user_session_path - return false - end - - true - end - def current_ability @current_ability ||= Ability.new(current_user) end diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index 47604cc3..52331eab 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -1,5 +1,5 @@ class ConferenceRegistrationsController < ApplicationController - before_filter :verify_user + before_filter :authenticate_user! load_resource :conference, find_by: :short_title authorize_resource :conference_registrations, class: Registration before_action :set_registration, only: [:edit, :update, :destroy, :show] diff --git a/app/controllers/proposal_controller.rb b/app/controllers/proposal_controller.rb index 76bdded6..5956f24f 100644 --- a/app/controllers/proposal_controller.rb +++ b/app/controllers/proposal_controller.rb @@ -1,5 +1,5 @@ class ProposalController < ApplicationController - before_filter :verify_user, except: [:show] + before_filter :authenticate_user!, except: [:show] load_resource :conference, find_by: :short_title load_and_authorize_resource :event, parent: false, through: :conference diff --git a/app/controllers/ticket_purchases_controller.rb b/app/controllers/ticket_purchases_controller.rb index 40059e69..a533871f 100644 --- a/app/controllers/ticket_purchases_controller.rb +++ b/app/controllers/ticket_purchases_controller.rb @@ -1,5 +1,5 @@ class TicketPurchasesController < ApplicationController - before_filter :verify_user + before_filter :authenticate_user! load_resource :conference, find_by: :short_title authorize_resource :conference_registrations, class: Registration diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 6b655847..fc6cc55e 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -1,5 +1,5 @@ class TicketsController < ApplicationController - before_filter :verify_user + before_filter :authenticate_user! load_resource :conference, find_by: :short_title load_resource :tickets, class: Ticket authorize_resource :conference_registrations, class: Registration diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d84f77e0..3975c9d4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - before_filter :verify_user + before_filter :authenticate_user! load_and_authorize_resource # GET /users/1