Module: AdvaUser::Authorization

Defined in:
lib/adva_user/authorization.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



3
4
5
6
7
# File 'lib/adva_user/authorization.rb', line 3

def self.included(controller)
  controller.class_eval do
    before_filter :authorize_user!
  end
end

Instance Method Details

#authorize_user!Object



9
10
11
12
13
# File 'lib/adva_user/authorization.rb', line 9

def authorize_user!
  unless current_user.admin?
    redirect_to root_url, :flash => {:alert => I18n.translate('flash.admin.access_denied')}
  end
end