Class: Redmine::SudoMode::Controller::SudoRequestFilter
- Inherits:
-
Struct
- Object
- Struct
- Redmine::SudoMode::Controller::SudoRequestFilter
- Defined in:
- lib/redmine/sudo_mode.rb
Overview
Before Filter which is used by the require_sudo_mode class method.
Instance Attribute Summary collapse
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#request_methods ⇒ Object
Returns the value of attribute request_methods.
Instance Method Summary collapse
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters
154 155 156 |
# File 'lib/redmine/sudo_mode.rb', line 154 def parameters @parameters end |
#request_methods ⇒ Object
Returns the value of attribute request_methods
154 155 156 |
# File 'lib/redmine/sudo_mode.rb', line 154 def request_methods @request_methods end |
Instance Method Details
#before(controller) ⇒ Object
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/redmine/sudo_mode.rb', line 155 def before(controller) method_matches = request_methods.blank? || request_methods.include?(controller.request.method_symbol) if controller.api_request? true elsif SudoMode.possible? && method_matches controller.require_sudo_mode(*parameters) else true end end |