Module: Redmine::SudoMode::Controller::ClassMethods
- Defined in:
- lib/redmine/sudo_mode.rb
Overview
Instance Method Summary collapse
-
#require_sudo_mode(*args) ⇒ Object
Handles sudo requirements for the given actions, preserving the named parameters, or any parameters if you omit the :parameters option.
Instance Method Details
#require_sudo_mode(*args) ⇒ Object
Handles sudo requirements for the given actions, preserving the named parameters, or any parameters if you omit the :parameters option.
Sudo enforcement by default is active for all requests to an action but may be limited to a certain subset of request methods via the :only option.
Examples:
require_sudo_mode :account, only: :post require_sudo_mode :update, :create, parameters: %w(role) require_sudo_mode :destroy
167 168 169 170 171 172 |
# File 'lib/redmine/sudo_mode.rb', line 167 def require_sudo_mode(*args) actions = args.dup = actions. filter = SudoRequestFilter.new Array([:parameters]), Array([:only]) before_action filter, only: actions end |