Module: Releaf::Permissions::ControllerSupport
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/releaf/permissions/controller_support.rb
Instance Method Summary collapse
- #authenticate! ⇒ Object
- #authorized? ⇒ Boolean
- #set_locale ⇒ Object
- #user ⇒ Object
- #verify_controller_access! ⇒ Object
Instance Method Details
#authenticate! ⇒ Object
28 29 30 31 |
# File 'lib/releaf/permissions/controller_support.rb', line 28 def authenticate! method_name = "authenticate_#{Releaf.application.config..devise_model_name}!" send(method_name) end |
#authorized? ⇒ Boolean
23 24 25 26 |
# File 'lib/releaf/permissions/controller_support.rb', line 23 def method_name = "#{Releaf.application.config..devise_model_name}_signed_in?" send(method_name) end |
#set_locale ⇒ Object
9 10 11 |
# File 'lib/releaf/permissions/controller_support.rb', line 9 def set_locale I18n.locale = user.locale end |
#user ⇒ Object
19 20 21 |
# File 'lib/releaf/permissions/controller_support.rb', line 19 def user send("current_#{Releaf.application.config..devise_model_name}") end |
#verify_controller_access! ⇒ Object
13 14 15 16 17 |
# File 'lib/releaf/permissions/controller_support.rb', line 13 def verify_controller_access! unless Releaf.application.config..access_control.new(user: user).controller_permitted?(short_name) raise Releaf::AccessDenied end end |