Class: Dbhero::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Dbhero::ApplicationController
- Defined in:
- app/controllers/dbhero/application_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
- #_current_user ⇒ Object
- #call_custom_auth ⇒ Object
- #check_auth ⇒ Object
- #user_representation ⇒ Object
Instance Method Details
#_current_user ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/dbhero/application_controller.rb', line 15 def _current_user if Dbhero.authenticate && Dbhero.current_user_method.present? send(Dbhero.current_user_method) end end |
#call_custom_auth ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/dbhero/application_controller.rb', line 21 def call_custom_auth cond = Dbhero.custom_user_auth_condition if cond.present? && cond.is_a?(Proc) cond.call(_current_user) else true end end |
#check_auth ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/controllers/dbhero/application_controller.rb', line 3 def check_auth if Dbhero.authenticate unless _current_user && call_custom_auth raise ActionController::RoutingError.new('Forbidden') end end end |
#user_representation ⇒ Object
11 12 13 |
# File 'app/controllers/dbhero/application_controller.rb', line 11 def user_representation _current_user.send(Dbhero.user_representation) if _current_user end |