Module: MicroAuth::ApplicationController::InstanceMethods
- Defined in:
- lib/micro_auth/application_controller.rb
Instance Method Summary collapse
-
#admin? ⇒ Boolean
Simple method to see if user is authenticated as admin.
-
#authenticate ⇒ Object
Simple filter method to verify user is admin in controllers.
Instance Method Details
#admin? ⇒ Boolean
Simple method to see if user is authenticated as admin.
18 19 20 |
# File 'lib/micro_auth/application_controller.rb', line 18 def admin? session[:admin] == true end |
#authenticate ⇒ Object
Simple filter method to verify user is admin in controllers.
10 11 12 13 14 15 |
# File 'lib/micro_auth/application_controller.rb', line 10 def authenticate unless admin? session[:target] = request.path redirect_to login_path, :alert => "You must be logged-in to view this page." end end |